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.
import java.util.Arrays;
import java.util.InputMismatchException;

import java.io.IOException;
import java.io.PrintWriter;

public class edu_17_re_c {
	public static int mod = 1000000007;
	static FastReader scan = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String args[]) {
		/******************* code ***********************/
		String s = scan.nextLine();
		int sum = 0;
		for (int i = 0; i < s.length(); i++) {
			sum += s.charAt(i) - '0';
		}
		if (sum % 3 == 0) {
			int temp = f(s);
			if (temp == s.length()) {
				out.println(0);
			} else {
				out.println(s.substring(temp, s.length()));
			}
		} else if (sum % 3 == 1) {
			StringBuilder s1 = new StringBuilder(s);
			StringBuilder s2 = new StringBuilder(s);
			int c1 = 0;
			int c2 = 0;
			for (int i = s.length() - 1; i >= 0; i--) {

				if ((s.charAt(i) - '0') % 3 == 1) {
					s1.deleteCharAt(i);
					c1++;
					break;
				}
			}
			for (int i = s.length() - 1; i >= 0; i--) {

				if ((s.charAt(i) - '0') % 3 == 2) {
					s2.deleteCharAt(i);
					c2++;
					if (c2 == 2)
						break;
				}
			}
			if (c1 == 0) {
				s1 = new StringBuilder("");
			}
			if (c2 < 2) {
				s2 = new StringBuilder("");
			}
			if (s1.length() == 0 && s2.length() == 0) {
				out.println(-1);
			} else {
				int t1 = f(s1.toString());
				int t2 = f(s2.toString());
				if (t1 == s1.length()) {
					s1 = new StringBuilder("0");
					t1 = 0;
				}
				if (t2 == s2.length()) {
					s2 = new StringBuilder("0");
					t2 = 0;
				}
				if (s1.length() - t1 > s2.length() - t2) {
					out.println(s1.toString().substring(t1));
				} else {
					out.println(s2.toString().substring(t2));
				}

			}
		} else if (sum % 3 == 2) {
			StringBuilder s1 = new StringBuilder(s);
			StringBuilder s2 = new StringBuilder(s);
			int c1 = 0;
			int c2 = 0;
			for (int i = s.length() - 1; i >= 0; i--) {

				if ((s.charAt(i) - '0') % 3 == 2) {
					s1.deleteCharAt(i);
					c1++;
					break;
				}
			}
			for (int i = s.length() - 1; i >= 0; i--) {

				if ((s.charAt(i) - '0') % 3 == 1) {
					s2.deleteCharAt(i);
					c2++;
					if (c2 == 2)
						break;
				}
			}
			if (c1 == 0) {
				s1 = new StringBuilder("");
			}
			if (c2 < 2) {
				s2 = new StringBuilder("");
			}
			if (s1.length() == 0 && s2.length() == 0) {
				out.println(-1);
			} else {
				int t1 = f(s1.toString());
				int t2 = f(s2.toString());
				if (t1 == s1.length()) {
					s1 = new StringBuilder("0");
					t1 = 0;
				}
				if (t2 == s2.length()) {
					s2 = new StringBuilder("0");
					t2 = 0;
				}
				if (s1.length() - t1 > s2.length() - t2) {
					out.println(s1.toString().substring(t1));
				} else {
					out.println(s2.toString().substring(t2));
				}

			}
		}
		out.close();

	}

	public static int f(String s) {
		int i = 0;
		while (i < s.length() && s.charAt(i) == '0') {
			i++;
		}
		return i;
	}

	static class Pair implements Comparable<Pair> {
		int x;
		int y;

		Pair(int xx, int yy) {
			x = xx;
			y = yy;
		}

		public String toString() {
			return "[x=" + x + ", y=" + y + "]";
		}

		@Override
		public int compareTo(Pair o) {
			if (Long.compare(this.y, o.y) != 0)
				return Integer.compare(this.y, o.y);
			else
				return Long.compare(this.x, o.x);
		}
	}

	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static long pow(long x, long n, long mod) {
		long res = 1;
		x %= mod;
		while (n > 0) {
			if (n % 2 == 1) {
				res = (res * x) % mod;
			}
			x = (x * x) % mod;
			n /= 2;
		}
		return res;
	}

	/************** Scanner ********************/
	static class FastReader {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int snumChars;

		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = System.in.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n) {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLong();
			}
			return arr;
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}

}
