S = input() T = "_" + input() n = int(input()) print(S + T * n)