S = input()
T = input()
N = int(input())

ans = S + ("_" + T) * N
print(ans)