# x=input() # f=x.split(" ") f=[2,9] xf=[int(i) for i in f] lxf=[] lxf.append(xf[0]) for i in range(xf[1]): lxf.append(lxf[-1] + 1) lxf2=[] for i in range(xf[1]+1): if lxf[:i] : lxf2.append(lxf[:i]) if len(lxf[:i])==len(lxf): break sr=[] for i in lxf2: s = '' for k in i: s+=str(k) sr.append(int(s)) print(sr) print(sum(sr))
[2, 23, 234, 2345, 23456, 234567, 2345678, 23456789, 2345678910]
2371742004
s=[] s.append(f[0]) for i in range(1,f[1]): k=f[0]+i s.append(int(str(s[-1])+str(k))) print(s) print(sum(s))
[698, 698699, 698699700, 698699700701, 698699700701702, 698699700701702703, 698699700701702703704, 698699700701702703704705, 698699700701702703704705706]
699399099801504207912618318