macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::collections::VecDeque;



fn bfs(h: i64, w: i64, s: Vec<Vec<bool>>) -> usize {
    let mut visited = vec![vec![false; w as usize]; h as usize];
    let mut res = 0;
    let next = vec![(0, -1), (-1, 0), (0, 1), (1, 0)];
    let mut q = VecDeque::new();
    for i in 0..h {
        for j in 0..w {
            if visited[i as usize][j as usize] {
                continue;
            }
            if s[i as usize][j as usize] {
                visited[i as usize][j as usize] = true;
                q.push_back(((i, j), true));
            }
            let mut black = 1;
            let mut white = 0;
            while let Some(((height, width), c)) = q.pop_front() {
                for n in 0..4 {
                    let n = next[n];
                    let height = height + n.1;
                    let width = width + n.0;
                    if width < 0 || height < 0 || width >= w || height >= h {
                        continue;
                    }
                    if visited[height as usize][width as usize] {
                        continue;
                    }
                    if c ^ s[height as usize][width as usize] {
                        q.push_back(((height, width), s[height as usize][width as usize]));
                        if s[height as usize][width as usize] {
                            black += 1;
                        } else {
                            white += 1;
                        }
                        visited[height as usize][width as usize] = true;
                    }
                }
            }
            res += black * white;
        }
    }
    res
}

const MOD: i64 = 1000000000 + 7;


fn solve(mut xs: Vec<i64>, mut ys: Vec<i64>) -> i64 {
    xs.sort();
    ys.sort();

    let mut x_total = 0;
    let len = xs.len() as i64;
    for i in 0..len {
        x_total += xs[i as usize] * i - xs[i as usize] * (len - 1 - i);
    }

    let mut y_total = 0;
    let len = ys.len() as i64;
    for i in 0..len {
        y_total += ys[i as usize] * i - ys[i as usize] * (len - 1 - i);
    }
    (x_total % MOD * y_total % MOD) % MOD
}

fn main() {
    input!{
        n: usize,
        m: usize,
        xs: [i64; n],
        ys: [i64; m],
    }
    println!("{}", solve(xs, ys));
}
