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

namespace sikakukei4_28
{
    class Program
    {
        static void Main(string[] args)
        {
           string[] nm = Console.ReadLine().Split(' ');
           string[] xtext = Console.ReadLine().Split(' ');
            string[] ytext = Console.ReadLine().Split(' ');

            int n = int.Parse(nm[0]);
            int m = int.Parse(nm[1]);

            int[] x = new int[n];
            int[] y = new int[m];
            for (int i = 0; i < n; i++)
            {
                x[i] = Convert.ToInt32(xtext[i]);
         
            }

            for (int i = 0; i < m; i++)
            {
                y[i] = Convert.ToInt32(ytext[i]);
            }


            int answer = 0;

            for(int k = 0; k < n-1; k++)
            {
                for(int l = 0; l < m-1; l++)
                {
                    answer = answer + (x[k + 1] - x[k]) * (y[l + 1] - y[l]) * (n - k-1) * (k+1) * (m - l-1) * (l+1);
                  //  Console.WriteLine(answer.ToString());
                }
            }

            int answer2 = answer;
            int waru = Convert.ToInt32(Math.Pow(10, 9));
            int answer3 = answer2 % (waru + 7);
           
            Console.WriteLine(answer3.ToString());
            

        }
    }
}