This morning Chef wants to jump a little. In a few minutes he will arrive at the point 0. Then he will perform a lot of jumps in such a sequence: 1-jump, 2-jump, 3-jump, 1-jump, 2-jump, 3-jump, 1-jump, and so on.
1-jump means that if Chef is at the point x, he will jump to the point x+1. 
2-jump means that if Chef is at the point x, he will jump to the point x+2. 
3-jump means that if Chef is at the point x, he will jump to the point x+3. 
Before the start Chef asks you: will he arrive at the point a after some number of jumps?

-----Input-----

The first line contains a single integer a denoting the point Chef asks about. 

-----Output-----
Output "yes" without a quotes if Chef can arrive at point a or "no" without a quotes otherwise.

-----Constraints-----

- 0 ≤ a ≤ 1018

-----Example-----
Input:
0

Output:
yes

Input:
1

Output:
yes

Input:
2

Output:
no

Input:
3

Output:
yes

Input:
6

Output:
yes

Input:
7

Output:
yes

Input:
10

Output:
no

-----Explanation-----
The first reached points are: 0 (+1) 1 (+2) 3 (+3) 6 (+1) 7, and so on.

Source: codechef | Difficulty: EASY
Tags: Number theory

Sorting

Mathematics

Complete search


Solutions:
N = int(input())
if N % 6 in [0, 1, 3]:
	print('yes')
else:
	print('no')


a = int(input())
if a == 0 or a == 1:
	print('yes')
elif a % 3 == 0:
	print('yes')
elif a % 6 == 0:
	print('yes')
elif a % 6 == 1:
	print('yes')
else:
	print('no')


n = int(input())
m = n % 6
if m == 0 or m == 1 or m == 3:
	print('yes')
else:
	print('no')


n = int(input())
if n % 3 == 0:
	print('yes')
elif n % 3 == 1 and n % 2 == 1:
	print('yes')
else:
	print('no')


a = int(input())
coord = 0
dist = 1
if a % 6 == 0 or a % 6 == 1 or a % 6 == 3:
	print('yes')
else:
	print('no')


try:
	n = int(input())
	a = n % 6
	if a == 0 or a == 1 or a == 3:
		print('yes')
	else:
		print('no')
except:
	pass


n = int(input())
if n <= 1:
	print('yes')
elif n % 6 == 1:
	print('yes')
elif n % 3 == 0:
	print('yes')
else:
	print('no')


number = int(input())
if number % 6 == 0 or number % 6 == 1 or number % 6 == 3:
	print('yes')
else:
	print('no')


t = 1

def BGOV(x):
	l = 0
	r = int(1000000000.0) + 10
	while l + 1 < r:
		md = (l + r) // 2
		if md // 6 > x:
			r = md
		else:
			l = md
	return l
while t:
	n = int(input())
	x = n // 6
	y = n % 6
	if y % 6 != 0:
		y -= 1
	if y % 6 != 0:
		y -= 2
	if y % 6 != 0:
		y -= 3
	if y % 6 != 0:
		print('no')
	else:
		print('yes')
	t -= 1


n = int(input())
if (n + 5) % 6 == 0 or (n + 3) % 6 == 0 or n % 6 == 0:
	print('yes')
else:
	print('no')


S = int(input())
ans = S % 6
if ans == 1 or ans == 3 or ans == 0:
	print('yes')
else:
	print('no')


n = int(input())
x = n // 6
print('yes' if n == x * 6 or n == x * 6 + 1 or n == x * 6 + 3 else 'no')


x = int(input())
i = 0
c = 1
if x % 3 == 0 or x % 6 == 1:
	print('yes')
else:
	print('no')


a = int(input())
if a == 0:
	print('yes')
elif a % 3 == 2:
	print('no')
elif a % 3 == 1:
	t = (a - 1) // 3
	if t % 2 == 0:
		print('yes')
	else:
		print('no')
else:
	print('yes')


a = int(input())
flag = False
if a % 6 == 0 or a % 6 == 1 or a % 6 == 3:
	flag = True
if flag:
	print('yes')
else:
	print('no')


a = int(input())
if a == 1:
	print('yes')
elif a % 3 == 0:
	print('yes')
else:
	mul = a // 3
	if mul & 1:
		print('no')
	elif 3 * mul + 1 == a:
		print('yes')
	else:
		print('no')