Esempio n. 1
0
        void Solve(StreamScanner ss, StreamWriter sw)
        {
            //---------------------------------
            var N = ss.Next(int.Parse);
            var M = ss.Next(int.Parse);
            var X = ss.Next(ModInt.Parse, N);
            var Y = ss.Next(ModInt.Parse, M);

            ModInt xs = 0;

            for (var i = 0; i < N; i++)
            {
                xs += i * X[i] - (N - i - 1) * X[i];
            }
            ModInt ys = 0;

            for (var j = 0; j < M; j++)
            {
                ys += j * Y[j] - (M - j - 1) * Y[j];
            }

            sw.WriteLine($"{xs * ys}");
            //---------------------------------
        }