#include<bits/stdc++.h>

using namespace std;

map<int, int> input_map;
map<int, int> user_map;
int main() {
	int n, m, a;
	string s;
	ifstream IN("input");
	ifstream ANS("answer"); 
	ifstream OUT("user_out");
	IN>>n;
	int x, input_sum = 0;
	for(int i = 0; i < n; i++) {
		IN >> x;
		input_map[x]++;
		input_sum += x;
	}
	assert(input_sum == 2 * n);
	ANS >> a;
	OUT >> m;
	if(a == -1) {
		if(m != -1) {
			cerr << "Wrong Answer";
			cout << "0";
		}
		else {
			while(OUT >> s) {
				cerr << "Too many outputs";
				cout << "0";
				return 0;
			}
			cout << "100";
		}
		return 0;
	}
	if(m == -1) {
		cerr << "Wrong Answer";
		cout << "0";
		return 0;
	}
	for(int i = 0; i < m; i++) {
		OUT >> x;
		user_map[x]++;
	}
	while(OUT >> s) {
		cerr << "Too many outputs";
		cout << "0";
		return 0;
	}
	
	long long sum = 0;
	for(auto &k : user_map) {
		sum += k.first * k.second;
		if(input_map[k.first] < k.second) {
			cerr << "Outputs are not a subset";
			cout << 0;
			return 0;
		} 
	}
	if(sum != n) {
		cerr << "Sum of the subset is " << sum;
		cout << "0";
		return 0;
	}
	cout << "100";
	IN.close();
	ANS.close();
	OUT.close();
	return 0;
}
