s = input() t = "_"+input() n = int(input()) print(s+t*n)