f=lambda x,n,p=1:p<=x and f(x,n,p*10)or n and f(x,n-1,p)*p+x or 0 print(f(10,4))print(f(3,9))print(f(3737,2))print(f(993,1))print(f(8888,8))
Standard input is empty
10101010 333333333 37373737 993 88888888888888888888888888888888
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!