#include<iostream>
using namespace std;
const int NMAX = 500;
long long int value(int row, int col);
const long long INF = 1e18 + 5;
long long val[NMAX + 5][NMAX + 5];
long long getValue(int x, int y)
{
    return (val[x][y] ? val[x][y] : val[x][y] = value(x, y));
}
pair<int, int> find_locmin_point(int n, int m)
{
    int st = 0, dr = m + 1;
    while(dr - st > 1)
    {
        int mid = (st + dr) >> 1;
        if(mid == m || (getValue(1, mid) < getValue(1, mid + 1)))
            dr = mid;
        else
            st = mid;
    }
    return {1, dr};
}