var
a,s,n:integer;
begin
repeat
write ('A =');readln(a);
until (a>=100) and (a<=999);</p>
n:=a;
while n div 10 <> 0 do begin
n:=a;
s:=s+a mod 10;
a:=a div 10;
end;
if (s mod 3 = 0) or (s mod 5 = 0) then writeln ('Yes') else writeln ('No');
readln;
end.