#include<stdio.h>//48
main()
{char s[10002]; int g,k;
for(k=0;k<=10001;k++)
s[k]='0';
while(scanf("%s",s)!=EOF){g=k=0;
if(s[0]=='-') s[0]='0';
for(k=0;k<=10001;k++)
g+=s[k]-48;
g%=3;
if(g==0) printf("yes\n");
else printf("no\n");
for(k=0;k<=10001;k++)
s[k]='0';
}
}