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.io.*;
import java.util.*;

public class MainClass
{
    static HashSet<Integer>[] adj = new HashSet[3];
    static ArrayList<Integer> start = new ArrayList<>();
    static ArrayList<Integer> end = new ArrayList<>();
    public static void main(String[] args)throws IOException
    {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String s = in.readLine();
        int[] S = new int[s.length()];
        int n = s.length();
        for (int i=0;i<s.length();i++)  S[i] = s.charAt(i) - '0';
        int[] sum = new int[n];
        sum[n - 1] = S[n - 1] % 3;
        for (int i=n - 2;i>=0;i--)  sum[i] = (S[i] + sum[i + 1]) % 3;
        for (int i=0;i<3;i++)   adj[i] = new HashSet<>();
        adj[S[n - 1] % 3].add(n - 1);
        for (int i=n - 2;i>=0;i--)
            adj[S[i] % 3].add(i);
        StringBuilder stringBuilder = new StringBuilder();
        int min = n + 1;
        for (int i=0;i<n;i++)
        {
            adj[S[i] % 3].remove(i);
            if (S[i] > 0)
            {
                int sumAhead = sum[i];
                int cost = i;
                if (sumAhead % 3 == 0)
                {
                    if (cost < min)
                    {
                        min = cost;
                        start.clear();
                        end.clear();
                        start.add(0);
                        end.add(i - 1);
                    }
                }
                else if (sumAhead % 3 == 1)
                {
                    if (adj[1].size() > 0 && cost + 1 < min)
                    {
                        min = cost + 1;
                        Iterator iterator = adj[1].iterator();
                        int idx1 = (int)iterator.next();
                        start.clear();
                        end.clear();
                        start.add(0);
                        end.add(i - 1);
                        start.add(idx1);
                        end.add(idx1);
                    }
                    else if (adj[2].size() >= 2 && cost + 2 < min)
                    {
                        min = cost + 2;
                        Iterator iterator = adj[2].iterator();
                        int a = (int)iterator.next();
                        int b = (int)iterator.next();
                        start.clear();
                        end.clear();
                        start.add(0);
                        end.add(i - 1);
                        int idx1 = Math.min(a, b);
                        int idx2 = Math.max(a, b);
                        start.add(idx1);
                        end.add(idx1);
                        start.add(idx2);
                        end.add(idx2);
                    }
                }
                else if (sumAhead % 3 == 2)
                {
                    if(adj[2].size() > 0 && cost + 1 < min)
                    {
                        min = cost + 1;
                        Iterator iterator = adj[2].iterator();
                        int idx1 = (int)iterator.next();
                        start.clear();
                        end.clear();
                        start.add(0);
                        end.add(i - 1);
                        start.add(idx1);
                        end.add(idx1);
                    }
                    else if (adj[1].size() >= 2 && cost + 2 < min)
                    {
                        min = cost + 2;
                        Iterator iterator = adj[1].iterator();
                        int a = (int)iterator.next();
                        int b = (int)iterator.next();
                        start.clear();
                        end.clear();
                        start.add(0);
                        end.add(i - 1);
                        int idx1 = Math.min(a, b);
                        int idx2 = Math.max(a, b);
                        start.add(idx1);
                        end.add(idx1);
                        start.add(idx2);
                        end.add(idx2);
                    }
                }
            }
        }
        if (sum[0] == 0)
        {
            System.out.println(s);
        }
        else if (min == n + 1)
        {
            boolean ff = false;
            for (int i=0;i<n;i++)
            {
                if (S[i] == 0)
                {
                    ff = true;
                    break;
                }
            }
            if (ff)
            {
                System.out.println(0);
            }
            else
                System.out.println(-1);
        }
        else
        {
            int last = -1;
            start.add(n);
            int size = start.size();
            for (int i=0;i<size;i++)
            {
                stringBuilder.append(s.substring(last + 1, start.get(i)));
                if (i < size - 1)
                    last = end.get(i);
            }
            System.out.println(stringBuilder);
        }
    }
}
class Reader
{
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public Reader()
    {
        din = new DataInputStream(System.in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public Reader(String file_name) throws IOException
    {
        din = new DataInputStream(new FileInputStream(file_name));
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public String readLine() throws IOException
    {
        byte[] buf = new byte[64]; // line length
        int cnt = 0, c;
        while ((c = read()) != -1)
        {
            if (c == '\n')
                break;
            buf[cnt++] = (byte) c;
        }
        return new String(buf, 0, cnt);
    }

    public int nextInt() throws IOException
    {
        int ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();
        do
        {
            ret = ret * 10 + c - '0';
        }  while ((c = read()) >= '0' && c <= '9');

        if (neg)
            return -ret;
        return ret;
    }

    public long nextLong() throws IOException
    {
        long ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();
        do {
            ret = ret * 10 + c - '0';
        }
        while ((c = read()) >= '0' && c <= '9');
        if (neg)
            return -ret;
        return ret;
    }

    public double nextDouble() throws IOException
    {
        double ret = 0, div = 1;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();

        do {
            ret = ret * 10 + c - '0';
        }
        while ((c = read()) >= '0' && c <= '9');

        if (c == '.')
        {
            while ((c = read()) >= '0' && c <= '9')
            {
                ret += (c - '0') / (div *= 10);
            }
        }

        if (neg)
            return -ret;
        return ret;
    }

    private void fillBuffer() throws IOException
    {
        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        if (bytesRead == -1)
            buffer[0] = -1;
    }

    private byte read() throws IOException
    {
        if (bufferPointer == bytesRead)
            fillBuffer();
        return buffer[bufferPointer++];
    }

    public void close() throws IOException
    {
        if (din == null)
            return;
        din.close();
    }
}