#include<bits/stdc++.h> using namespace std; int main(){ int a[10],year; for(int i=0;i<10;i++){ cin>>a[i]; } cin>>year; cout<<a[year%10]<<endl<<a[year%10]-a[year%10-1]; return 0; }