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.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.StringTokenizer;

public class Main  implements Runnable {
    public static void main(String[] args) {
        new Thread(null, new Main(), "", 64 * 1024 * 1024).start();
    }
    public void run() {
    	FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		String str = sc.next();
		char[] c = str.toCharArray();
		long ans = 0;
		int n = (int)Math.pow(2,(double)c.length-1);
		for (int i = 0; i < n; i++) {
			long tmp = (c[0] - '0');
			for (int j = 1; j < c.length; j++) {
				if((i>>(j-1)&1)==0)
				{
					tmp=tmp*(long)10;
					tmp += (c[j]-'0');
				}
				else {
					ans += tmp;
					tmp = (c[j]-'0');
				}
			}
			ans += tmp;
		}

		out.printf("%d", ans);
		out.flush();
	}

    
    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;
        public FastScanner(String in) {
        	StringReader sr = new StringReader(in);
            reader = new BufferedReader(new BufferedReader(sr));
            tokenizer = null;
        }
        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }
        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }
    }
}