#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
vector<string>names;
vector<int>value;
string a;
int b,i;
while(cin>>a&&cin>>b)
{
names.push_back(a);
value.push_back(b);
}
cin>>a;
for(i=0;i<names.size();i++)
{
if(names[i]==a)
cout<<value[i];
}
getchar();
return 0;
}