S = input() T = input() N = int(input()) print(S + ('_' + T) * N)