# coding: utf-8
# Your code here!

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

print("_".join([S]+[T]*N))