#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
typedef long long LL;
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
const int N = 4e5 + 5;

int n, m, a[N], b[N];
LL ans = 4e17, suf[N], pre[N];

int main() {
	cin>>n>>m;
	rep (i, 1, n) cin>>a[i];
	sort(a + 1, a + n + 1);
	rep (i, 1, m) cin>>b[i];
	sort(b + 1, b + m + 1);
	per (i, n, 1) suf[i] = suf[i + 1] + a[i]*(i&1 ? 1 : -1);
	rep (i, 1, n) pre[i] = pre[i - 1] + a[i]*(i&1 ? -1 : 1);
	rep (i, 1, n) {
		int pos = lower_bound(b + 1, b + m + 1, a[i]) - b;
		if (pos != m + 1) ans = min(ans, pre[i - 1] + suf[i + 1] + b[pos] - a[i]);
		if (pos != 1) ans = min(ans, pre[i - 1] + suf[i + 1] + a[i] - b[pos - 1]);
	}
	printf("%lld\n", ans);
}
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=1e5+10,mod=998244353;
typedef long long LL;
LL qpow(LL x,LL k){
	LL res=1;
	while(k){
		if(k&1)res=res*x%mod;
		x=x*x%mod;
		k>>=1;
	}
	return res;
}
int main(){
	long long n,m,k;
	scanf("%lld%lld%lld",&n,&m,&k);
	if(n==1){
		printf("%lld",qpow(k,m));
	}
	else if(m==1){
		printf("%lld",qpow(k,n));
	}
	else{
		LL res=0;
		for(int i=1;i<=k;i++){//最小值的最大值是i时 
			res=(res+((qpow(i,n)-qpow(i-1,n)+mod)*qpow(k-i+1,m)%mod)+mod)%mod;
		}
		cout<<res;
	}
	return 0;
}