import sys input = sys.stdin.readline def main(): S = input()[:-1] T = input()[:-1] N = int(input()) print(S + ("_" + T) * N) if __name__ == '__main__': main()