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:
/*      MOHD SADIQ        */

import java.sql.Array;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;

public class Main {

    private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    private long longVal() throws IOException{
        return Long.parseLong(br.readLine().trim());
    }
    private int intVal() throws IOException{
        return Integer.parseInt(br.readLine().trim());
    }
    private double doubleVal() throws IOException{
        return Double.parseDouble(br.readLine().trim());
    }
    private int[] intArr() throws IOException{
        String[] s = br.readLine().trim().split(" ");
        int n = s.length;
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(s[i]);
        }
        return a;
    }
    private long[] longArr() throws IOException {
        String[] s = br.readLine().trim().split(" ");
        int n = s.length;
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = Long.parseLong(s[i]);
        }
        return a;
    }
    private double[] doubleArr() throws IOException {
        String[] s = br.readLine().trim().split(" ");
        int n = s.length;
        double[] a = new double[n];
        for (int i = 0; i < n; i++) {
            a[i] = Double.parseDouble(s[i]);
        }
        return a;
    }
    private String[] stringArr() throws IOException{
        String[] s = br.readLine().trim().split(" ");
        return s;
    }
    private char[] charArr() throws IOException{
        return br.readLine().trim().toCharArray();
    }
    private static boolean[] sieve(int n){
        boolean[] primes = new boolean[n + 1];
        int i;
        Arrays.fill(primes,true);
        for(i = 2; i * i <= n; ++i) {
            if (primes[i]) {
                for(int p = i * i; p <= n; p += i) {
                    primes[p] = false;
                }
            }
        }
        return primes;
    }

    static  class BST {
        int key;
        BST left, right;
        BST(int val) {
            this.key = val;
            this.left = null;
            this.right = null;
        }
    }

    private static String solve() throws IOException {
        Main obj = new Main();
        String s = br.readLine().trim();
        StringBuilder ans = new StringBuilder(s);
        char[] c = s.toCharArray();
        int n = c.length;
        long sum = 0;
        for(int i=0;i<n;i++){
            sum += c[i]-'0';
        }
        long mod = sum %3;
        char m= (char)(mod +'0');
        if(mod ==0)
            return ans+"";
        ArrayList<String> al = new ArrayList<>();
//        StringBuilder ans = new StringBuilder(s);
        for(int i=n-1;i>=0;i--){
            if((c[i]-'0')%3==mod){
                ans.replace(i,i+1,"");
                int j = 0;
                while (j<ans.length() && ans.charAt(j)=='0'){
                    j++;
                }
                if (j!=0 && ans.length()==j && ans.charAt(0)=='0')
                    j--;
                al.add(ans.substring(j,ans.length()));
                break;
            }
        }
//        System.out.println(al.get(0));
        if(mod == 1){
            int count = 0;
            ans= new StringBuilder(s);
            for(int i=n-1;i>=0;i--){
                if((c[i]-'0')%3==2 && count<=1){
                    ans.replace(i,i+1,"");
                    count ++;
                    if(count == 2) {
                        int j = 0;
                        while (j < ans.length() && ans.charAt(j) == '0') {
                            j++;
                        }
                        if (j!=0 && ans.length()==j && ans.charAt(0)=='0')
                            j--;
                        al.add(ans.substring(j, ans.length()));
                        break;
                    }
                }
            }
        }
        else {
            int count = 0;
            ans= new StringBuilder(s);
            for(int i=n-1;i>=0;i--){
                if((c[i]-'0')%3==1 && count<=1){
                    ans.replace(i,i+1,"");
                    count ++;
//                    System.out.println(count);
                    if(count == 2) {
                        int j = 0;
                        while (j < ans.length() && ans.charAt(j) == '0') {
                            j++;
                        }
                        if (j!=0 && ans.length()==j && ans.charAt(0)=='0')
                            j--;
                        al.add(ans.substring(j, ans.length()));
                        break;
                    }
                }
            }
        }
        int[] arr = new int[al.size()];
        for(int i=0;i<arr.length;i++)
            arr[i] = al.get(i).length();
        int max = 0;
        for(int i=0;i<arr.length;i++)
            max = Math.max(arr[i],max);
//        System.out.println(max);
        if(max == 0 )
            return "-1";
        for(int i=0;i<arr.length;i++){
            if(arr[i]==max)
                return al.get(i);
        }
        return "-1";
    }

    public static void main(String[] args) throws IOException {
        Main ob = new Main();
//        int total_test_case = ob.intVal();
        int total_test_case = 1;
        StringBuffer ans = new StringBuffer();
        String k ;
        for(int test_case =0;test_case<total_test_case;test_case++){
            k = Main.solve();
//            System.out.println(k);
            ans.append(k+"\n");
        }
        System.out.print(ans);
    }
}