import std.stdio, std.string,std.range, std.conv, std.array, std.algorithm, std.math, std.typecons, std.bigint;

void main() {
  auto S = readln.chomp;

  //
  ulong func(string[] strs, int count) {
    if (count == S.length) {
      return strs.to!(ulong[]).sum;
    }
    auto res = func(strs ~ S[count].to!string, count+1);
    if (strs.length > 0) {
      strs[$-1] ~= S[count];
      return res + func(strs, count + 1);
    }
    return res;
  }

  writeln(func(null, 0));
}
