var
s:string;
i,sum:longint;
begin
while not eof do begin
readln(s);
if s[1]='-' then delete(s,1,1);
for i:=1 to length(s) do sum:=sum+ord(s[i])-48;
if sum mod 3=0 then writeln('yes')
else writeln('no');
sum:=0;
end;
end.