using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoderBeginner
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            string[] xAxis = Console.ReadLine().Split(' ');
            string[] yAxis = Console.ReadLine().Split(' ');
            const int MOD = 1000000007;

            Console.WriteLine((Sum(input[0], xAxis) * Sum(input[1], yAxis)) % MOD);

            Console.ReadLine();

        }

        static int Sum(string _input, string[] _tmp)
        {
            int _num = int.Parse(_input);
            int sum = 0;
            for (int i = _num - 1; i > 0; i--)
            {
                for (int j = 0; j < i; j++)
                {
                    sum += (int.Parse(_tmp[i]) - int.Parse(_tmp[j]));
                }
            }
            return sum;
        }

    }
    
}
