i=input;N=int(i());s=i();l=i();n=N;j=0

exec("j=max(n*(s[-n:]==l[:n]),j);n-=1;"*N);print((2*N-j))
i=raw_input;N=n=int(i());s,l,j=i(),i(),0;

exec("j=max(n*(s[-n:]==l[:n]),j);n-=1;"*N);

print(2*N-j)
i = input
N = int(i())
s = i()
l = i()
n = N
j = 0
exec("j=max(n*(s[-n:]==l[:n]),j);n-=1;" * N)
print((2 * N - j))

i = raw_input
N = n = int(i())
s, l, j = i(), i(), 0
exec("j=max(n*(s[-n:]==l[:n]),j);n-=1;" * N)
print(2 * N - j)

-i = input -N = int(i()) -s = i() -l = i() -n = N -j = 0 +i = raw_input +N = n = int(i()) +s, l, j = i(), i(), 0 -print((2 * N - j)) +print(2 * N - j)