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