#include<bits/stdc++.h>

#define ll long long
#define pb push_back
#define pii pair < int, int >

using namespace std;

map < pii, ll > mem;

ll value (int i, int j);

ll ask (int j) {
    int i = 1;
    if (mem.find({i, j}) != mem.end())
        return mem[{i, j}];
    return mem[{i, j}] = value(i, j);
}

pii find_locmin_point (int n, int m) {

    int l = 1, r = m;
    while (l + 1 < r) {

        int m = l + r >> 1;
        if (ask(m - 1) > ask(m))
            l = m;
        else
            r = m - 1;
    }
    if (ask(l) < ask(r))
        return {1, l};
    else
        return {1, r};
}

//      /
//\    /
// \  /
//  \/

//
//int main () {
//    ios_base::sync_with_stdio(0);
//    cin.tie(0);
//    int test = 1;
//    while (test--) {
////        slv();
//        cout << "\n";
//    }
//}
