#include <bits/stdc++.h>
using namespace std;
string s;
long long dp(long long at, long long c, long long sum) {
  c = c * 10 + s[at] - '0';
  if (at == s.length() - 1) return sum + c;
  return dp(at + 1, c, sum) + dp(at + 1, 0, sum + c);
}
int main() {
  cin >> s;
  cout << dp(0ll, 0ll, 0ll) << '\n';
  return 0;
}
