f=c(1,cumprod(1:11));for(v in scan("stdin","")){b=rev(as.numeric(strsplit(v,"")[[1]]));write(sum(f[1:length(b)]*b),T)}