using System;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;
using System.Text.RegularExpressions;
using static System.Console;

namespace CsTest
{
    class Program
    {
        static void Main()
        {
            long[] nm = AtCoder.ReadInt64Array();
            var n = nm[0];
            var m = nm[1];
            int[] x = AtCoder.ReadInt32Array();
            int[] y = AtCoder.ReadInt32Array();

            var result = new BigInteger();

            for (int xi = 0; xi < n - 1; xi++) for (int yi = 0; yi < m - 1; yi++)
                {
                    var hidariuekazu = (xi + 1) * (yi + 1);
                    var migisitakazu = (x.Length - xi - 1) * (y.Length - yi - 1);
                    result += BigInteger.Multiply((x[xi + 1] - x[xi]), (y[yi + 1] - y[yi])) * hidariuekazu * migisitakazu;
                }


            WriteLine(result % 1000000007);
        }
    }

    public class AtCoder
    {
        public static int ReadInt32() => int.Parse(ReadLine());
        public static string[] ReadStringArray() => ReadLine().Split(Array.Empty<char>(), StringSplitOptions.RemoveEmptyEntries);
        public static int[] ReadInt32Array() => ReadStringArray().Select(s => int.Parse(s)).ToArray();
        public static long[] ReadInt64Array() => ReadStringArray().Select(s => long.Parse(s)).ToArray();
    }
    public static class PermutationsAndCombinations
    {
        public static long nCr(int n, int r)
        {
            // naive: return Factorial(n) / Factorial(r) * Factorial(n - r);
            return n - 2 * r < 0? nCr(n, n - r) : nPr(n, r) / Factorial(r);
        }

        public static long nPr(int n, int r)
        {
            // naive: return Factorial(n) / Factorial(n - r);
            return FactorialDivision(n, n - r);
        }

        private static long FactorialDivision(int topFactorial, int divisorFactorial)
        {
            long result = 1;
            for (int i = topFactorial; i > divisorFactorial; i--)
                result *= i;
            return result;
        }

        private static long Factorial(int i)
        {
            if (i <= 1)
                return 1;
            return i * Factorial(i - 1);
        }
    }
}