#! /usr/bin/env python3
from functools import reduce
import sys
def programming048( *args) :
return reduce ( lambda s_1, s_2:
s_1 + s_2[ reduce ( lambda init, cnt:
cnt if s_1[ -cnt:] == s_2[ :cnt] else init,
range ( 1 , 1 + min ( [ len ( i) for i in [ s_1, s_2] ] ) ) ,
0 ) :] ,
args[ 1 :] , args[ 0 ] )
if __name__ == "__main__" :
print ( programming048( *sys .argv [ 1 :] ) )
IyEgL3Vzci9iaW4vZW52IHB5dGhvbjMKCmZyb20gZnVuY3Rvb2xzIGltcG9ydCByZWR1Y2UKaW1wb3J0IHN5cwoKZGVmIHByb2dyYW1taW5nMDQ4KCphcmdzKToKICAgIHJldHVybiByZWR1Y2UobGFtYmRhIHNfMSwgc18yOgogICAgICAgICAgICAgICAgICBzXzEgKyBzXzJbcmVkdWNlKGxhbWJkYSBpbml0LCBjbnQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY250IGlmIHNfMVstY250Ol0gPT0gc18yWzpjbnRdIGVsc2UgaW5pdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByYW5nZSgxLCAxICsgbWluKFtsZW4oaSkgZm9yIGkgaW4gW3NfMSwgc18yXV0pKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwKTpdLAogICAgICAgICAgICAgICAgICBhcmdzWzE6XSwgYXJnc1swXSkKCmlmIF9fbmFtZV9fID09ICJfX21haW5fXyI6CiAgICBwcmludChwcm9ncmFtbWluZzA0OCgqc3lzLmFyZ3ZbMTpdKSkKCg==