s = input() t = input() n = int(input()) v = [s] + [t] * n print("_".join(v))