n = int(eval(input()))

s = str(eval(input()))

t = str(eval(input()))



if s == t:

    print(n)

    exit()



for i in range(n):

    #print(s[i:], t[:n-1-i+1])

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

        break

else:

    i = n

    #pass

ans = i*2+(n-i)

print(ans)

n = int(eval(input()))

s = str(eval(input()))

t = str(eval(input()))



if s == t:

    print(n)

    exit()



for i in range(1, n):

    s_ = s[i:n]

    t_ = t[0:n-i]

    if s_ == t_:

        ans = s[:i]+t

        print((len(ans)))

        exit()

else:

    print((2*n))

n = int(eval(input()))
s = str(eval(input()))
t = str(eval(input()))
if s == t:
    print(n)
    exit()
for i in range(n):
    # print(s[i:], t[:n-1-i+1])
    if s[i:] == t[: n - 1 - i + 1]:
        break
else:
    i = n
    # pass
ans = i * 2 + (n - i)
print(ans)

n = int(eval(input()))
s = str(eval(input()))
t = str(eval(input()))
if s == t:
    print(n)
    exit()
for i in range(1, n):
    s_ = s[i:n]
    t_ = t[0 : n - i]
    if s_ == t_:
        ans = s[:i] + t
        print((len(ans)))
        exit()
else:
    print((2 * n))

-for i in range(n): -    # print(s[i:], t[:n-1-i+1]) -    if s[i:] == t[: n - 1 - i + 1]: -        break +for i in range(1, n): +    s_ = s[i:n] +    t_ = t[0 : n - i] +    if s_ == t_: +        ans = s[:i] + t +        print((len(ans))) +        exit() -    i = n -    # pass -ans = i * 2 + (n - i) -print(ans) +    print((2 * n))