N = int(eval(input()))

s = eval(input())

t = eval(input())



ans = 2 * N

for i in range(1, N+1):

    # print(s[-i:], t[:i])

    if s[-i:] == t[:i]:

        ans = min(ans, 2 * N - i)

print(ans)

N = int(eval(input()))

prefix = eval(input())

suffix = eval(input())





if len(prefix) + len(suffix) < N:

    d = N - len(prefix) + len(suffix)

    print((len(prefix + 'a' * d + suffix)))

else:

    s = ""

    for i in range(1, N):

        # print(prefix[-i:], suffix[:i])

        if prefix[-i:] == suffix[:i]:

            s = prefix[:-i] + suffix

    if suffix == prefix:

        s = suffix

    if len(s) == 0:

        s = prefix + suffix

    print((len(s)))



N = int(eval(input()))
s = eval(input())
t = eval(input())
ans = 2 * N
for i in range(1, N + 1):
    # print(s[-i:], t[:i])
    if s[-i:] == t[:i]:
        ans = min(ans, 2 * N - i)
print(ans)

N = int(eval(input()))
prefix = eval(input())
suffix = eval(input())
if len(prefix) + len(suffix) < N:
    d = N - len(prefix) + len(suffix)
    print((len(prefix + "a" * d + suffix)))
else:
    s = ""
    for i in range(1, N):
        # print(prefix[-i:], suffix[:i])
        if prefix[-i:] == suffix[:i]:
            s = prefix[:-i] + suffix
    if suffix == prefix:
        s = suffix
    if len(s) == 0:
        s = prefix + suffix
    print((len(s)))

-s = eval(input()) -t = eval(input()) -ans = 2 * N -for i in range(1, N + 1): -    # print(s[-i:], t[:i]) -    if s[-i:] == t[:i]: -        ans = min(ans, 2 * N - i) -print(ans) +prefix = eval(input()) +suffix = eval(input()) +if len(prefix) + len(suffix) < N: +    d = N - len(prefix) + len(suffix) +    print((len(prefix + "a" * d + suffix))) +else: +    s = "" +    for i in range(1, N): +        # print(prefix[-i:], suffix[:i]) +        if prefix[-i:] == suffix[:i]: +            s = prefix[:-i] + suffix +    if suffix == prefix: +        s = suffix +    if len(s) == 0: +        s = prefix + suffix +    print((len(s)))