program multiple_of_9
  implicit none
  character(200000) :: s
  integer(8) :: n = 0, m
  integer :: l, i
  read(*,'(a)') s
  l = len_trim(s)
  do i = 1, l, 10
    read(s(i:min(i + 9, l)),*) m
    n = n + m
  end do
  write(*,'(a)') trim(merge('Yes', 'No ', mod(n, 9_8) == 0))
end program multiple_of_9