N = int(input()) print(['Yes','No'][0 if N % 6 == 0 else 1])