N = int(input())
a = N % 3
if a == 0 or '3' in 'N':
    print('YES')
else:
    print('NO')

cd89c078d97f13b939b39a73b5bb78452eed91f9
<mask token>

<mask token>
if a == 0 or '3' in 'N':
    print('YES')
else:
    print('NO')

N = int(input())
a = N % 3
if a == 0 or '3' in 'N':
    print('YES')
else:
    print('NO')
