#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================



int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================


	string S;
	cin >> S;

	ll ans = 0;

	ll size = S.length();
	
	vll N(size);
	
	for (ll i = 0; i < size; i++) {
		N[i] = ll(S[i]) - 48;
	}

	ll time = 0;

	for (ll bit = 0; bit < (1<<size-1) ; bit++) {

		ll local = 0;
		for (ll i = 0; i < size-1; i++) {

			local *= 10;
			local += N[i];

			if ((bit >> (size - 2 - i)) & 1) {
				ans += local;
				local = 0;

				if (i == size - 2) {

					ans += local + N[i + 1];
					local = 0;
				}
			}
			else {
				if (i == size - 2) {
					local *= 10;
					ans += local + N[i + 1];
					local = 0;
				}
			}



		}
		time++;
	}

	if (size == 1) {
		cout << S;
		return 0;
	}

	cout << ans << endl;





}



### FIXED CODE ###

import sys
import math
import fractions
import bisect
import queue
import heapq
import collections
import itertools
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint=====================================
N, K = map(int, input().split())
N, M = map(int, input().split())
A, B = map(int, input().split())

H, W = map(int, input().split())

L, R = map(int, input().split())

1行のstring=================================
S, T = input().split()

1行の整数配列================================
P = list(map(int,input().split()))

A = list(map(int,input().split()))
B = list(map(int,input().split()))

D = list(map(int,input().split()))

L = list(map(int,input().split()))
R = list(map(int,input().split()))

T = list(map(int,input().split()))

改行あり整数==================================
X = []
Y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    X.append(x1)
    Y.append(y1)

A = []
for i in range(N):
    a=int(input())
    A.append(a)

Pair = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    Pair.append((x1, y1))
    
2次元整数配列=====================================
A = []
for i in range(N):
    tmp = list(map(int,input().split()))
    A.append(tmp)


N行M列の初期化====================================
dp = [[VAL] * RETU for i in range(GYO)]

'''



S = input()

S = S[::-1]



ans = int(S[0]) * (2**(len(S)-1))
for i in range(1, len(S)):
    final = 0    
    for keta in range(0, i+1):
        if keta == i:
            final = 1
        ans += int(S[i]) * (10**keta) * (2**int(len(S)-2-keta+final))
        #print(S[i], keta, int(S[i]) * (10**keta) * (2**int(len(S)-2-keta+final)))
print(ans)