A positive integer number *n* is written on a blackboard. It consists of not more than 10<sup class="upper-index">5</sup> 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.
The first line of input contains *n* — a positive integer number without leading zeroes (1 ≤ *n* &lt; 10<sup class="upper-index">100000</sup>).
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.
1033
33
10
0
11
-1
3
3
1
-1
117
117
518
18
327
327
270461
70461
609209
60909
110930
930
37616145150713688775
3616145150713688775
98509135612114839419
9509135612114839419
41674994051436988162
1674994051436988162
82547062721736129804
82547062721736129804
4902501252475186372406731932548506197390793597574544727433297197476846519276598727359617092494798814
490501252475186372406731932548506197390793597574544727433297197476846519276598727359617092494798814
1291007209605301446874998623691572528836214969878676835460982410817526074579818247646933326771899122
1291007209605301446874998623691572528836214969878676835460982410817526074579818247646933326771899122
5388306043547446322173224045662327678394712363272776811399689704247387317165308057863239568137902157
538830603547446322173224045662327678394712363272776811399689704247387317165308057863239568137902157
20000111
200001
100222
1002
202
0
100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000033
33
101
0
1000000222
10000002
1001
0
205
0
102211
10221
100000002022
1000000002
20203
3
1002001
100200
10002223
100023
1002223
10023
100000231
10000023
220
0
322
3
100000222
1000002
10033
33
2003302
330
10011001
1001001
20000000011001111
200000000001111
100000000
0
1000
0
200000000000000000000000000008
0
1000000000000222
10000000000002
100000000000000000222
1000000000000000002
29512
2952
88888888888888
888888888888
100000000000222
1000000000002
11000000
0
2200
0
10000555
100005
1000222
10002
10021
1002
223
3
1013
3
100020001
10002000
20000000000000000000932
93
1010
0
2000000002222
20000000022
10213
1023
109111
10911
1010101010
10001010
300055
3000
200200
0
202222
2022
4000888
40008
200000111
2000001
2000000111
20000001
1000000
0
1003301
330
100001
0
40000000000000000000888
400000000000000000008
100000
0
4000000888
40000008
334733
3333
1000002220
10000020
100321
10032
101111
1011
100000000222
1000000002
10001
0
7
-1
2000000000111
20000000001
100000001
0
10000000000222
100000000002
200000000000000111
2000000000000001
404044
40044
30202
300
20000000000000000111
200000000000000001
707
0
20000300000000003000050000003
30000000000300000000003
400000888
4000008
2888
888
200111
2001
10000000888
100000008
40000888
400008
40404044
400044
5500000000
0
100012
10002
1000007
0
200093
93
10000000222
100000002
20000000002
0
74333
333
200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008
0
10000000111
1000000011
100007
0
20000006711
200000061
8059
9
8008
0
88
-1
2002
0
2000111
20001
100000000100000002
10000000000000002
1000000000000000000000000000000000
0
10000000000000000222
100000000000000002
1000001
0
200000000000111
2000000000001
2000000002
0
2010000100001
10000100001
200330
330
10000222
100002
2005
0
100000000000822
1000000000002
10000000000000000000000
0
7046
6
4000117
400017
971
9
404
0
5
-1
164
6
140
0
74
-1
2058232
20232
4
-1
20206
6
103310
330
100
0
417179
7179
70558
558
298
9
7003
3
2212
222
1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
0
2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
0
1002200
100200
1222
222
101200100
10100100
1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003
3
20020201
2002020
12122
1122
20200
0
2
-1
1000000000000258
10000000000008
n = input()
summa = 0
for i in n:
    summa += int(i)
if summa % 3 == 0:
    print(n)
else:
    for i in range(len(n)):
        if int(n[i]) % 3 == summa % 3:
            n = n[:i] + n[i+1:]
            j = 0
            while len(n) != 1 and j < len(n) and n[j] == "0":
                j += 1
            print(n[j:])
            break
    else:
        print(-1)