X, Y = map(int, input().split()) if (abs(X)+abs(Y)) % 3 != 0: print("NO") exit() if abs(X)+abs(Y) > 9: print("NO") exit() print("YES")