s, h, t = list(map(str, input().split())) if s == h: ans = s else: ans = s + h print(ans if len(ans) <= int(t) else -1)