N = int(eval(input()))

s = input().strip()

t = input().strip()

k = 0

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

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

        k = i

        continue

print((2*N-k))
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()
k = 0
for i in range(1, N + 1):
    if s[-i:] == t[:i]:
        k = i
        continue
print((2 * N - k))

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))

-k = 0 -for i in range(1, N + 1): -    if s[-i:] == t[:i]: -        k = i -        continue -print((2 * N - k)) +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))