using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

class Prog
{
  public static void Main()
  {
    var nm = Console.ReadLine().Split(' ').Select(i => Int32.Parse(i)).ToList();
    var xs = Console.ReadLine().Split(' ').Select(i => Int32.Parse(i)).ToList();
    var ys = Console.ReadLine().Split(' ').Select(i => Int32.Parse(i)).ToList();
    int xsum=0;
    int ysum=0;
    for(var i = 0; i < nm[0] - 1;i++)
    {
      for(var j = i + 1; j < nm[0]; j++)
      {
        xsum += (xs[j] - xs[i])%10000007;
      }
    }
    for(var i = 0; i < nm[0] - 1;i++)
    {
      for(var j = i + 1; j < nm[0]; j++)
      {
        ysum += ys[j] - ys[i]%10000007;
      }
    }
    Console.WriteLine(xsum*ysum);
  }
}
