#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const int MAXN = 100005;
int xx[MAXN], yy[MAXN], n;
bool vis[MAXN];
void die(){
    cerr<<"Something is wrong..."<<endl;
    cout<<0<<endl;
    exit(0);
}
int main(int argc, char **argv) {
    ifstream IN("input"),OUT("user_out"),ANS("answer");
    IN>>n;
    for (int i = 1; i <= n; i++) {
        IN>>xx[i];
        IN>>yy[i];
    }
    int m;
    OUT>>m;
    if(m<0 || m>n/2)die();
    ll out = 0, res;
    ANS>>res;
    for (int i = 1; i <= m; i++) {
        int u, v;
        OUT>>u>>v;
        if(!(1<=u && u<=n && 1<=v && v<=n))die();
        if (vis[u])die();
        if (vis[v])die();
        if (u == v)die();
        vis[u] = vis[v] = 1;
        out += max(abs(xx[u] - xx[v]), abs(yy[u] - yy[v]));
    }
    if (res != out)die();
    cout<<100<<endl;
    return 0;
}
