N = int(eval(input()))

S = eval(input())

T = eval(input())



k = 0



for i in range(N):

    for j in range(N):

        s = S[i:]

        t = T[:j + 1]

        if s == t:

            k = max(k, len(s))



print((2 * N - k))

N = int(eval(input()))

S = eval(input())

T = eval(input())



for l in range(N, 2 * N + 1):

    if S[N - 2 * N + l:] == T[:2 * N - l]:

        print(l)

        exit()

N = int(eval(input()))
S = eval(input())
T = eval(input())
k = 0
for i in range(N):
    for j in range(N):
        s = S[i:]
        t = T[: j + 1]
        if s == t:
            k = max(k, len(s))
print((2 * N - k))

N = int(eval(input()))
S = eval(input())
T = eval(input())
for l in range(N, 2 * N + 1):
    if S[N - 2 * N + l :] == T[: 2 * N - l]:
        print(l)
        exit()

-k = 0 -for i in range(N): -    for j in range(N): -        s = S[i:] -        t = T[: j + 1] -        if s == t: -            k = max(k, len(s)) -print((2 * N - k)) +for l in range(N, 2 * N + 1): +    if S[N - 2 * N + l :] == T[: 2 * N - l]: +        print(l) +        exit()