using System;
using System.Collections.Generic;
using System.Linq;
using static AtCoder.Io;

namespace AtCoder
{
    class Program
    {
        public static readonly long Mod = (long)Math.Pow(10, 9) + 7;
        static void Main()
        {
            var nm = ReadLongArray();
            var n = nm[0];
            var m = nm[1];
            var x = ReadLongArray();
            var y = ReadLongArray();

            long total = 0;
            for (var i = 0; i < n - 1; i++)
            {
                for (var j = 0; j < m - 1; j++)
                {
                    long area = (x[i + 1] - x[i]) * (y[j + 1] - y[j]) % Mod;
                    long dup = (n - 1 - i) * (i + 1) * (m - 1 - j) * (j + 1);
                    total = (total + area * dup) % Mod;
                }
            }
            Console.WriteLine($"{total}");
        }
    }

    public static class Io
    {
        public static string ReadString() => Console.ReadLine();
        public static string[] ReadStringArray() => ReadString().Split(' ');
        public static int ReadInt() => int.Parse(ReadString());
        public static long ReadLong() => long.Parse(ReadString());
        public static int[] ReadIntArray() => ReadStringArray().ParseInt().ToArray();
        public static long[] ReadLongArray() => ReadStringArray().ParseLong().ToArray();
        public static IEnumerable<int> ParseInt(this IEnumerable<string> source) => source.Select(int.Parse);
        public static IEnumerable<long> ParseLong(this IEnumerable<string> source) => source.Select(long.Parse);
    }
}
