S = input() T = input() N = int(input()) st = [S] + ([T] * N) print("_".join(st))