Problem: A positive integer number n is written on a blackboard. It consists of not more than 105 digits. You have to transform it into a beautiful number by erasing some of the digits, and you want to erase as few digits as possible.

The number is called beautiful if it consists of at least one digit, doesn't have leading zeroes and is a multiple of 3. For example, 0, 99, 10110 are beautiful numbers, and 00, 03, 122 are not.

Write a program which for the given n will find a beautiful number such that n can be transformed into this number by erasing as few digits as possible. You can erase an arbitraty set of digits. For example, they don't have to go one after another in the number n.

If it's impossible to obtain a beautiful number, print -1. If there are multiple answers, print any of them.

Input

The first line of input contains n — a positive integer number without leading zeroes (1 ≤ n < 10100000).

Output

Print one number — any beautiful number obtained by erasing as few as possible digits. If there is no answer, print  - 1.

Examples

Input

1033


Output

33


Input

10


Output

0


Input

11


Output

-1

Note

In the first example it is enough to erase only the first digit to obtain a multiple of 3. But if we erase the first digit, then we obtain a number with a leading zero. So the minimum number of digits to be erased is two.

Solution (in PYTHON3):

Solution:
def sumstr(s):
	sums = 0
	for i in range(len(s)):
		sums += int(s[i])
	return sums
	
def mod3(s):
	sums = sumstr(s)
	return sums % 3

def onlyzeros(s):
	i = 0
	while i < len(s):
		if s[i] != '0':
			return False
		i += 1
	return True

def lastin(s, s1):
	maxf = -1
	#d = '-'
	for d in s1:
		f = s.rfind(d)
		#print(d, f, maxf)
		if f > maxf:
			maxf = f
	return maxf

def del1(s, s1):
	if s[0] == '-':
		return '-'
	maxf = lastin(s, s1)
	#print('lastfin', maxf)
	if maxf != -1:
		#found digit
		if maxf != 0:
			#not first or can del first
			ret = s[:maxf]
			if maxf + 1 < len(s):
				ret = ret + s[maxf + 1:]
			return ret
		elif len(s) > 1 and s[1] != '0':
			return s[1:]
		elif len(s) == 1:
			return '-'
		else:
			ind = 1
			while ind < len(s) and s[ind] == '0':
				ind += 1
			if ind == len(s):
				return '0'
			else:
				return s[ind:]
	else:
		return '-'

def only0(s):
	if '0' in s:
		return '0'
	else:
		return '-'
		

from random import randint

def testing():
	s = input()
	#n = randint(0, 10000000000000000)
	#n = 0
	#s = str(n)
	#print(s, mod3(s))

	m3 = mod3(s)
	if m3 == 0:
		print(s)
	elif m3 == 1:
		var1 = del1(s, '147')
		var2 = del1(del1(s, '258'), '258')
		var3 = only0(s)
		l1 = len(var1)
		l2 = len(var2)
		if l1 > l2:
			#not -
			#print('v1')
			print(var1)
		elif l2 > l1:
			#print('v2')
			print(var2)
		else:
			#eq
			if var1[0] != '-':
				print(var1)
			elif var2[0] != '-':
				print(var2)
			elif var3[0] != '-':
				print(var3)
			else:
				print(-1)
		
	elif m3 == 2:
		var1 = del1(s, '258')
		var2 = del1(del1(s, '147'), '147')
		var3 = only0(s)
		l1 = len(var1)
		l2 = len(var2)
		if l1 > l2:
			#not -
			print(var1)
			#print('v1')
		elif l2 > l1:
			print(var2)
			#print('v2')
		else:
			#eq
			if var1[0] != '-':
				print(var1)
			elif var2[0] != '-':
				print(var2)
			elif var3[0] != '-':
				print(var3)
			else:
				print(-1)
	#print('\n\n')


for i in range(1):
	testing()