import sys def input(): return sys.stdin.readline()[:-1] S=int(input()) ans='NO' for i in range(500): for j in range(1000): if (2000*i*j+j**2)%(10**6)==S: ans='YES' print(ans)