I=input;n=i=int(I());s,t=I(),I();j=0;exec('j=max(i*(s[-i:]==t[:i]),j);i-=1;'*n);print((2*n-j))
I=input;n=int(I());s,t=I(),I();print((2*n-max(i*(s[-i:]==t[:i])for i in range(n+1))))
I = input
n = i = int(I())
s, t = I(), I()
j = 0
exec("j=max(i*(s[-i:]==t[:i]),j);i-=1;" * n)
print((2 * n - j))

I = input
n = int(I())
s, t = I(), I()
print((2 * n - max(i * (s[-i:] == t[:i]) for i in range(n + 1))))

-n = i = int(I()) +n = int(I()) -j = 0 -exec("j=max(i*(s[-i:]==t[:i]),j);i-=1;" * n) -print((2 * n - j)) +print((2 * n - max(i * (s[-i:] == t[:i]) for i in range(n + 1))))