class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @a = gets.split(//).map(&:to_i)
  end

  def solve
    a.sum % 9 == 0
  end

  def show(ans)
    puts ans ? "Yes" : "No"
  end
end

Problem.new.instance_eval do
  show(solve)
end