#include<bits/stdc++.h>
//on T4 25minutes last
//bai lan
// my last poems
//this is the players  you mean
//it is reading out thoughts
//throw they words
//on the screens
//...
//...
//every thing is end
//wake up

//6 minutes left
//ready to write my AFO letter if i can't pass the first exam next year

//5 minutes
// I have to close all of my tools
// good night
using namespace std;
typedef long long ll;
const int N=1e5+10;
int t,n,a[N],b[N],q;
vector<pair<int,int> >ra;
ll ans;
inline ll read(){
	int x=0;
	bool f=true;
	char ch=getchar();
	for(;!isdigit(ch);ch=getchar())
		if(ch=='-')f=false;
	for(;isdigit(ch);ch=getchar())
		x=(x<<1)+(x<<3)+ch-'0';
	return f?x:~(x-1);
}
int main(){
	freopen("match.in","r",stdin);
	freopen("match.out","w",stdout);
	t=read(),n=read();
	for(int i=1;i<=n;i++){
		a[i]=read();
	}
	for(int i=1;i<=n;i++){
		b[i]=read();
	}
	q=read();
	while(q--){
		int l=read(),r=read();
		ra.push_back(make_pair(l,r));
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			ans+=a[i]*b[j];
		}
	}
	printf("%lld",ans);
	return 0;
}