var
a,z:string;
s,b,c,i:longint;
begin
while not eof do begin
c:=0;
readln(a);
b:=length(a);
for i:=1 to 335 do z:=concat(z,a);
for i:=1 to b do c:=c+(ord(a[i]))-48;
if c mod 3=0 then writeln(*yes*)
else writeln(*no*);
end;
end.
a,z:string;
s,b,c,i:longint;
begin
while not eof do begin
c:=0;
readln(a);
b:=length(a);
for i:=1 to 335 do z:=concat(z,a);
for i:=1 to b do c:=c+(ord(a[i]))-48;
if c mod 3=0 then writeln(*yes*)
else writeln(*no*);
end;
end.