n = int(eval(input()))

s = eval(input())

t = eval(input())



ans = n * 2

for i in range(n):

    if s[n - i - 1:] == t[:i + 1]:

        ans = min(ans, n * 2 - (i + 1))

print(ans)

n = int(eval(input()))

s = eval(input())

t = eval(input())



a = 0

for i in range(n):

    if s[n - i - 1:] == t[:i + 1]:

        a = i + 1

print((n * 2 - a))

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

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

-ans = n * 2 +a = 0 -        ans = min(ans, n * 2 - (i + 1)) -print(ans) +        a = i + 1 +print((n * 2 - a))