using System;
using System.Linq;

namespace arc071_b
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long[] x = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long[] y = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long[] xsa = new long[x.Count() - 1];
            for (int i = 0; i < x.Count() - 1; i++)
            {
                xsa[i] = x[i + 1] - x[i];
            }
            long[] ysa = new long[y.Count() - 1];
            for (int i = 0; i < y.Count() - 1; i++)
            {
                ysa[i] = y[i + 1] - y[i];
            }
            long ret = 0;
            for (int i = 0; i < a[0] - 1; i++)
            {
                for (int j = 0; j < a[1] - 1; j++)
                {
                    ret += xsa[i] * ysa[j] % 1000000007 * (i + 1) % 1000000007 * (j + 1) % 1000000007 * (a[0] - i - 1) % 1000000007 * (a[1] - j - 1) % 1000000007;
                    ret %= 1000000007;
                }
            }
            Console.WriteLine(ret);
        }
    }
}