#28886: python 一行解


jeter.nice@gmail.com (唯一)


import sys;[(lambda n:print("YES") if n%3==0 else print("NO")) (i) for i in map(int,sys.stdin)]