x, y = map(int,input().split()) if (abs(x)+abs(y))%3 == 0 and abs(x)+abs(y) <= 9: print('YES') else: print('NO')