#include "bits/stdc++.h"
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;

#define int           long long
#define ld            long double
const int mod =       1e9 + 7;
const int inf =       1e18;
#define vi            vector<int>
#define vs            vector<string>
#define pii           pair<int, int>
#define ump           unordered_map
#define pq_max        priority_queue<int>
#define pq_min        priority_queue<int, vi, greater<int>>
#define ff            first
#define ss            second
#define pb            emplace_back
#define loop(i, a, b)  for(int i = a; i < b; ++i)
#define rev(i, a, b)  for(int i = a; i > b; --i)
#define all(x)        x.begin(), x.end()
#define range(a, b)   substr(a, b - a + 1)
#define ps(x, y)      fixed << setprecision(y) << x
#define setbits(n)    __builtin_popcountll(n)
#define zerobits(n)   __builtin_ctzll(n)
mt19937               rng(chrono::steady_clock::now().time_since_epoch().count());

#define log(args...)  { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss);                  err(_it, args); }
#define logarr(arr)   for(auto &i : arr) cout << i << ' '; cout << '\n';
#define token(str,ch) (std::istringstream var((str)); vs v; string t; while(getline((var), t, (ch))) { v.pb(t); } return v;)
vs tokenizer(string str, char ch) { std::istringstream var((str)); vs v; string t; while (getline((var), t, (ch))) { v.pb(t); } return v; }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}

// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void solve() {
	double a, b;
	cin >> a >> b;

	double disc = (a - b);

	cout << disc / a * 100;
}

int32_t main() {
	clock_t begin = clock();
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);


	int t = 1;
	// cin >> t;

	while (t--) {
		solve();
	}


#ifndef ONLINE_JUDGE
	clock_t end = clock();
	cout << "\n\nExecuted In: " << double(end - begin) / CLOCKS_PER_SEC * 1000 << " ms";
#endif
	return 0;
}
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<class T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<class T,class Size=typename vector<T>::size_type>inline auto vector_2d(Size h,Size w,T v){return vector<vector<T>>(h,vector<T>(w,v));}
template<class T>auto comp_pairs_by_second(){return[](const T&p1,const T&p2){return p1.second<p2.second||(p1.second==p2.second&&p1.first<p2.first);};}

int main()
{
    ll n=in(),m=in();
    vector<pair<ll,ll>>cond(m);
    for(ll i=0;i<m;++i){
        ll a=in(),b=in();
        cond[i]={a-1,b-1};
    }
    ll k=in();
    vector<pair<ll,ll>>person(k);
    for(ll i=0;i<k;++i){
        ll a=in(),b=in();
        person[i]={a-1,b-1};
    }
    ll ans=0;
    for(ll i=0;i<(1<<k);++i){
        ll tmp=0;
        vector<ll>foo(n);
        for(ll j=0;j<k;++j)++foo[(i>>j)&1?person[j].first:person[j].second];
        for(auto c:cond)if(foo[c.first]&&foo[c.second])++tmp;
        ans=max(ans,tmp);
    }
    cout<<ans<<endl;
}
