#include <iostream>
#include <string>
using namespace std;
int main()
{
string str;
while (cin >> str)
{
int sum = 0;
for (int i = (str[0] == '-' ? 1 : 0); i < str.length(); i++)
{
sum += (str[i] - '0');
}
cout << ((sum % 3 == 0) ? "yes" : "no") << endl;
}
return 0;
}