6
12 8 12 17 20 5
17 4 8 8 8 4
 6
4 1 12 9 3 11
12 20 19 12 19 11
 1
1
1
 2
1 2
1 1
 1
7
5
 6
16 20 18 7 14 2
17 12 4 10 7 4

705
 917
 1
 9
 5
 741

from itertools import count, chain

_ = input()
f = [int(x) for x in input().split()]
s = [int(x) for x in input().split()]

s1 = sum(x * y for x, y in zip(count(), f + s[::-1]))
s2 = sum(x * y for x, y in zip(count(), [f[0], ] + s + f[:0:-1]))
s3 = sum(x * y for x, y in zip(count(), chain.from_iterable((y, x) if i % 2 else (x, y) for i, (x, y) in enumerate(zip(f, s)))))

print(max(s1, s2, s3))