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(' ');
            

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

        }

        const int MOD = 1000000007;

        static long Sum(string _input, string[] _tmp)
        {
            int _num = int.Parse(_input);
            long sum = 0;
            for (int i = 0; i < _num; i++)
            {
                sum += long.Parse(_tmp[i]) * (2 * i - _num + 1);
            }
            return sum % MOD;
        }
    }
}

