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 JAVA):

Solution:
/**
 * DA-IICT
 * Author : Savaliya Sagar
 */
import java.io.*;
import java.math.*;
import java.util.*;

public class C792 {
	InputStream is;
	PrintWriter out;
	int n;
	String s;
	int dp[][];
	int max[] = new int[3];
	int maxvalue[] = new int[3];
	Pair p[][];
	StringBuilder ans = new StringBuilder();
	void solve() {
		s = ns();
		n = s.length();
		Arrays.fill(max,-1);
		p = new Pair[n+1][3];
		for(int i=0;i<n+1;i++){
			Arrays.fill(p[i],new Pair(-1,-1));
		}
		int flag = 0;
		for(int i=1;i<=n;i++){
			int tmax[] = new int[3];
			int tmaxvalue[] = new int[3];
			int c = Character.getNumericValue(s.charAt(i-1));
			if(c==0)
				flag = 1;
			for(int j=0;j<3;j++){
				if(maxvalue[j]==0)
					continue;
				if(maxvalue[j]+1>maxvalue[(c+j)%3]){
					tmaxvalue[(c+j)%3] = maxvalue[j]+1;
					p[i][(c+j)%3] = new Pair(max[j],j);
					tmax[(c+j)%3] = i;
				}
				if(tmaxvalue[j]==0){
					tmaxvalue[j] = maxvalue[j];
					tmax[j] = max[j];
				}
			}
			if(tmaxvalue[c%3]==0 && c!=0)
			{
				tmaxvalue[c%3] = 1;
				tmax[c%3] = i;
			}
			maxvalue = tmaxvalue;
			max = tmax;
		}
		if(maxvalue[0]==0)
			if(flag==0)
				out.println(-1);
			else
				out.println(0);
		else{
			findAns(max[0],0);
			out.println(ans);
		}
	}
	public void findAns(int i,int j){
		if(i==-1 && j==-1)
			return;
		findAns(p[i][j].i,p[i][j].j);
		ans.append(s.charAt(i-1));
	}
	class Pair{
		int i;
		int j;
		Pair(int i,int j){
			this.i = i;
			this.j = j;
		}
	}
	void run() throws Exception {
		String INPUT = "/media/sagar407/D/java workspace/11Input_output/input.txt";
		is = oj ? System.in : new FileInputStream(INPUT);
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new C792().run();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b !=
									// ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

	private void tr(Object... o) {
		if (!oj)
			System.out.println(Arrays.deepToString(o));
	}
}