import strutils

let
  s, t = readLine stdin
  n = parseInt readLine stdin

echo s, ("_" & t).repeat n