#include<cstdio> #include<vector> using namespace std; int main(){ int n, m; scanf("%d %d", &n, &m); vector<int>vec1; vector<int>vec2; vector<int>vec3; for (int i = 0; i < n; i++){ int k; scanf("%d", &k); vec1.push_back(k); } for (int i = 0; i < m; i++){ int k; scanf("%d", &k); vec2.push_back(k); } int x1, y1; int x2, y2; scanf("%d %d", &x1, &y1); scanf("%d %d", &x2, &y2); for (int i = x1 - 1; i < y1 - 1; i++){ int s = vec1[i]; vec3.push_back(s); } for (int i = x2 - 1; i < y2 - 1; i++){ int s = vec2[i]; vec3.push_back(s); } int j = vec3.size(); if (j % 2 == 0){ printf("%d", vec3[j / 2 - 1]); } if (j % 2 == 1){ printf("%d", vec3[j / 2]); } }