package main import ( "bufio" "os" "strconv" ) func main() { run() } func run() { setSpace() N := readN() dim := N + 1 as := make([]int, dim) for i := 0; i < dim; i++ { a := readN() as[i] = a } cs := make([]int, 2*dim) for ib := 0; ib < dim; ib++ { b := readN() for ia := 0; ia < dim; ia++ { cs[ia+ib] += as[ia] * b } } // fmt.Printf("debug: %v\n", cs) // \sum_{i=0}^n{ c_i } sumC := 0 for i := 0; i < dim; i++ { sumC = (sumC + cs[i]) % (1e9 + 7) } println(sumC) } // ------以下、ユーティリティ------ var sc = bufio.NewScanner(os.Stdin) func setSpace() { sc.Split(bufio.ScanWords) } func read() string { sc.Scan() return sc.Text() } func readN() int { n, err := strconv.Atoi(read()) if err != nil { panic(err) } return n }