N = int(eval(input()))

s = input().strip()

t = input().strip()

ind = -1

for i in range(N):

    x = s[i:]

    y = t[:N-i]

    if x==y:

        ind = i

        break

if ind>=0:

    print((N+i))

else:

    print((2*N))
N = int(eval(input()))

s = input().strip()

t = input().strip()

lmin = 2*N

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

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

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

print(lmin)
N = int(eval(input()))
s = input().strip()
t = input().strip()
ind = -1
for i in range(N):
    x = s[i:]
    y = t[: N - i]
    if x == y:
        ind = i
        break
if ind >= 0:
    print((N + i))
else:
    print((2 * N))

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

-ind = -1 -for i in range(N): -    x = s[i:] -    y = t[: N - i] -    if x == y: -        ind = i -        break -if ind >= 0: -    print((N + i)) -else: -    print((2 * N)) +lmin = 2 * N +for i in range(1, N + 1): +    if s[-i:] == t[:i]: +        lmin = min(lmin, 2 * N - i) +print(lmin)