using System;
class Program
    {
        static void Main(string[] args)
        {
            string[] input1 = Console.ReadLine().Split(' ');
            string[] input2 = Console.ReadLine().Split(' ');
            string[] input3 = Console.ReadLine().Split(' ');
            Console.WriteLine(new Output().Calu(input1,input2,input3).ToString());
        }

        public class Output{
            public Output(){

            }
            
            private long Sum(string[] s, int n){
                long Sum=0;
                for (int i = 0; i < n; i++) {
                    Sum += long.Parse(s[i]) * (2 * i - n + 1); 
                }                               
                return Sum;
            }
            public long Calu(string[] input1, string[] input2, string[] input3)
            {
                const int MOD = 1000000007;
                return ((Sum(input2, int.Parse(input1[0])) % MOD) * (Sum(input3, int.Parse(input1[1]) % MOD))) % MOD;
            }
        }
    }