N = int(eval(input()))

s = eval(input())

t = eval(input())



ans = len(s) + len(t)

for i in range(len(s)):

    if t[:i+1] in s:

        ans = min(ans, len(s) + len(t) - (i+1))

        

print(ans)
N = int(eval(input()))

s = eval(input())

t = eval(input())



ans = 2*N

for i in range(N):

    if s[N-(i+1):] == t[:i+1]:

        ans = 2*N - (i+1)

        

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

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

-ans = len(s) + len(t) -for i in range(len(s)): -    if t[: i + 1] in s: -        ans = min(ans, len(s) + len(t) - (i + 1)) +ans = 2 * N +for i in range(N): +    if s[N - (i + 1) :] == t[: i + 1]: +        ans = 2 * N - (i + 1)