time limit per test 2.0 second

Consider the integer X and its decimal representation d1 … dn. Lets define a split as pair of numbers d1 … dk and dk+1 … dn for any k between 1 and n inclusively (last split consists of X itself). For example, number 1234 can be split in next ways: 1 and 234, 12 and 34, 123 and 4 and 1234.

Lets define a key of the number as the sum of all 2n-1 integers, generated by splits. For example, key of number 1234 is 1+234+12+34+123+4+1234=1642.

Given the key, print any integer which generate it or -1 if no such integer exists.

Input format

The input contains one integer K (1 ≤ K ≤ 1015) — given key.

Output format

Print any integer for which K is key or -1 if no such integer exists.

Autor: - Husayn

For send solution