use strict;
use warnings;

my $in = <>;
chomp $in;
my ($n, $m) = split(/ /, $in);

$in = <>;
chomp $in;
my @x = split(/ /, $in);

$in = <>;
chomp $in;
my @y = split(/ /, $in);

my $sum = 0;
for(my $i = 0; $i < (@x - 1); $i++){
	my $area_x = (@x - ($i+1)) * ($i+1);
	for(my $j = 0; $j < (@y - 1); $j++){
		my $area_num = $area_x * ((@y - ($j+1)) * ($j+1));
		my $q;
		$q = ($x[$i+1] - $x[$i]) * ($y[$j+1] - $y[$j]);
		#printf("(%d-%d)*(%d-%d)=%d\n", $x[$i+1], $x[$i],$y[$j+1],$y[$j],$q);
		
		$q %= (10 ** 9) + 7;
		$sum += $q*$area_num;
		$sum %= (10 ** 9) + 7;
	}
}

print $sum."\n";


exit;
