S=input().strip() T=input().strip() N=int(input()) print(S+"_"+"_".join([T for _ in range(N)]))