#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v(32);
  int p;
  for (int i = 0; i < 32; i++) {
    cin >> p;
    v.push_back(p);
  }
  int k;
  cin >> k;
  cout << v[k + 1] << endl;
}
