#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+5;
struct node1{
int x,y;
}a[N];
struct node2{
int x,y;
}b[N];
bool vis[N];
inline int read(){
int s=0,f=1;
char ch=getchar();
while(!isdigit(ch)){
if(ch=='-') f=-1;
ch=getchar();
}
while(isdigit(ch)){
s=(s<<3)+(s<<1)+(ch-'0');
ch=getchar();
}
return s*f;
}
inline bool operator < (node1 x,node1 y){
if(x.x!=y.x) return x.x>y.x;
return x.y>y.y;
}
inline bool operator < (node2 x,node2 y){
if(x.x!=y.x) return x.x>y.x;
return x.y>y.y;
}
signed main(){
freopen("10.in","r",stdin);
int n,m;cin>>n>>m;
for(int i=1;i<=n;i++){
a[i].x=read();a[i].y=read();
}
for(int i=1;i<=m;i++){
b[i].x=read();b[i].y=read();
}
sort(a+1,a+n+1);
sort(b+1,b+m+1);
int pla=0,ans=0,cnt=0;
for(int i=1;i<=m;i++){
while(a[pla+1].x>=b[i].x && a[pla+1].y>=b[i].y && pla<n) pla++;
for(int j=pla;j>=1;j--){
if(vis[j]==0){
vis[j]=1;
cnt++;
ans+=(1ll*500*b[i].x+2*b[i].y);
break;
}
}
}
printf("%lld %lld",cnt,ans);
return 0;
}