def main(): a = input() b = input() c = input() print('_'.join([a]+[b]*int(c))) if __name__ == '__main__': main()