prime

Consider the sequence of prime numbers: p1=2, p2=3, p3=5, p4=7, ... .
The integer n (n>=2) has the p-writing a1a2...ak-1ak if it can be written in the following form:
n=a1*p1+a2*p2+...+ak-1*pk-1+ak*pk, where ak=1, and ai can be either 0 or 1, for any i, 0<i<k.

E.g. n=10 has both p-writing 111, because 10=1*2+1*3+1*5, as well as p-writing 0101 because 10=0*2+1*3+0*5+1*7.

Task

Write a program that reads the p-writing of an integer and calculates the decimal value of this integer.

Input data

The first line of input file prime.in contains the p-writing of a positive integer.

Output data

The output file prime.out will contain a single line on which your program should write the decimal value of the number corresponding to the p-writing in the input file.

Constraints

Example

prime.in

prime.out

Explanation

100101

22

22=2*1+0*3+0*5+1*7+0*11+1*13

 Time limit: 0.1 seconds/test

prof. Boriga Radu
“Spiru Haret” National College - Bucharest
Contact: r_boriga@yahoo.com