You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion.

All strings that can be obtained in this way can be evaluated as formulas.

Evaluate all possible formulas, and print the sum of the results.

Constraints

* 1 \leq |S| \leq 10
* All letters in S are digits between `1` and `9`, inclusive.

Input

The input is given from Standard Input in the following format:


S


Output

Print the sum of the evaluated value over all possible formulas.

Examples

Input

125


Output

176


Input

9999999999


Output

12656242944
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

public final class Main {
	public static void main(String[] args) throws java.lang.Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		Solver sol = new Solver();
		System.out.println(sol.solve(s));
	}

}

class Solver {
	int getBitPosition(int i) {
		int count = 1;
		while ((i >>= 1) > 0)
			count++;
		return count;
	}

	long getSumOf(long[] aa, int i, int j) {
		long sum = 0;
		for (int a = j; a >= i; a--) {
			sum += (long) (aa[a] * Math.pow(10, j - a));
		}
		return sum;
	}

	long solve(String s) {

		char in[] = s.toCharArray();
		long inp[] = new long[in.length];
		for (int ii = 0; ii < in.length; ii++) {
			inp[ii] = in[ii] - '0';
		}
		long sum = 0;
		int ways = 1 << (in.length - 1);
		for (int ii = 1; ii < ways; ii++) {
			long temp = 0;
			int i = ii;
			int last = inp.length - 1;
			while (i > 0) {
				int n = getBitPosition(i & -i);
				n = in.length - n;
				temp += getSumOf(inp, n, last);
				last = n - 1;
				if ((i & (i - 1)) == 0) {
					temp += getSumOf(inp, 0, last);
				}
				i = i & (i - 1);

			}
			sum += temp;
		}
		return sum + getSumOf(inp, 0, inp.length - 1);
	}

}
