import sequtils, strutils let n: int = stdin.readline.parseInt a: seq[int] = mapIt(0..n, stdin.readline.parseInt) b: seq[int] = mapIt(0..n, stdin.readline.parseInt) mods: int = 1000000007 var ans: int = 0 tmp: int = 0 for i in 0..n: tmp = (tmp + b[i]) mod mods for i in 0..n: ans = (ans + a[i] * tmp) mod mods tmp = (tmp - b[n - i] + mods) mod mods echo ans