#include <bits/stdc++.h>
using namespace std;
int main()
{
string a;
int b=0;
while(cin>>a)
{
for(int i=0; i<a.length(); i++)
{
b+=a[i]-'0';
}
if(b==0) cout<<"yes"<<endl;
else if(b%3==0) cout<<"yes"<<endl;
else cout<<"no"<<endl;
b=0;
}
}