program b176
 
implicit none
character(len=200000) :: a 
integer :: n, i, t

read *, a

n = 0

do i = 1, 200000
 if (a(i:i) == ' ') then
  exit
 else
  read(a(i:i),*) t
  n = n + t
 end if
end do

!print *, n
 
if(mod(n, 9) == 0) then
 print *, 'Yes'
else
 print *, 'No'
end if


end program b176