#include "locmin.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
typedef long long ll;
const double P = .5 + sqrt(5)/2.0;
map<pi,ll> CA;

ll query(int r, int c){
    if(CA.find(pi{r,c}) != CA.end()) return CA[{r,c}];
    return CA[{r,c}] = value(r,c);
}

pi find_locmin_point(int N, int M) {
    if(N == 1) {
        for(int l = 1,r = M;;){
            if(l == r) return {1,l};
            int m1 = (l * (1.0+P) + r * P)/(1.0+2.0*P);
            int m2 = (l * P + r * (1.0+P))/(1.0+2.0*P);
            ll a1 = query(1,m1);
            ll a2 = query(1,m2);
            if(a1 < a2) r = m2-1;
            else l = m1 + 1;
        }
    }
    return {6,7};
}
