#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MAXN = 1e3;
const int MAXLog = log2(MAXN) + 1;
#define md ((lf+rg)/2)
#define lc (pos*2)
#define rc (pos*2+1)
int n, m;
int arr[MAXN+5];
int segtree[4*MAXN+5];
int merge(int a, int b){
return Secret(a, b);
}
void build(int lf, int rg, int pos){
if(lf == rg){
segtree[pos] = arr[lf];
return ;
}
build(lf, md, lc);
build(md+1, rg, rc);
segtree[pos] = merge(segtree[lc], segtree[rc]);
}
int res = -1;
void query(int ql, int qr, int lf, int rg, int pos){
if(rg < ql || qr < lf) return ;
if(ql <= lf && rg <= qr){
if(res == -1) res = segtree[pos];
else res = merge(res, segtree[pos]);
// cerr << "hah : " << lf << ' ' << rg << " -> " << res << endl;
return ;
}
query(ql, qr, lf, md, lc);
query(ql, qr, md+1, rg, rc);
}
void Init(int N, int A[]) {
n = N;
for(int i = 1; i <= n; i++) arr[i] = A[i-1];
build(1, n, 1);
}
int Query(int L, int R) {
int l = L + 1, r = R + 1;
res = -1;
query(l, r, 1, n, 1);
int ans = res;
return ans;
}