~cpp if __name__=='__main__': n=3 L = [input() for i in range(n)] j=int(raw_input('')) for k in range(j): L[0]=str(L[0]) a=int(L[0])+int(L[0][::-1]) L[0]=str(a) print a j=int(raw_input('')) for k in range(j): L[1]=str(L[1]) b=int(L[1])+int(L[1][::-1]) L[1]=str(b) print b j=int(raw_input('')) for k in range(j): L[2]=str(L[2]) c=int(L[2])+int(L[2][::-1]) L[2]=str(c) print c