      PROGRAM piyo
      IMPLICIT NONE
      INTEGER,PARAMETER :: p = 8
      integer(p) :: N(2*10**5+1)
      N = 0
      read'(*(i1))',N
      
      if( mod(sum(N),9)==0 )then
        print*,'Yes'
      else
        print*,'No'
      end if
      
      
      stop
      !debugg
      
      print*,n(1:10)
      
      
      END PROGRAM