s = input() t = input() n = int(input()) print(s+("_"+t)*n)