Problem: Today the North Pole hosts an Olympiad in a sport called... toy igloo skyscrapers' building!

There are n walruses taking part in the contest. Each walrus is given a unique number from 1 to n. After start each walrus begins to build his own igloo skyscraper. Initially, at the moment of time equal to 0, the height of the skyscraper i-th walrus is equal to ai. Each minute the i-th walrus finishes building bi floors.

The journalists that are reporting from the spot where the Olympiad is taking place, make q queries to the organizers. Each query is characterized by a group of three numbers li, ri, ti. The organizers respond to each query with a number x, such that:

1. Number x lies on the interval from li to ri inclusive (li ≤ x ≤ ri).

2. The skyscraper of the walrus number x possesses the maximum height among the skyscrapers of all walruses from the interval [li, ri] at the moment of time ti.

For each journalists' query print the number of the walrus x that meets the above-given criteria. If there are several possible answers, print any of them.

Input

The first line contains numbers n and q (1 ≤ n, q ≤ 105). Next n lines contain pairs of numbers ai, bi (1 ≤ ai, bi ≤ 109). Then follow q queries i the following format li, ri, ti, one per each line (1 ≤ li ≤ ri ≤ n, 0 ≤ ti ≤ 106). All input numbers are integers.

Output

For each journalists' query print the number of the walrus x that meets the criteria, given in the statement. Print one number per line.

Examples

Input

5 4
4 1
3 5
6 2
3 5
6 5
1 5 2
1 3 5
1 1 0
1 5 0


Output

5
2
1
5


Input

5 4
6 1
5 1
2 5
4 3
6 1
2 4 1
3 4 5
1 4 5
1 2 0


Output

3
3
3
1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int n, q;
pair<double, int> best[350][350];
double eps = 1e-9;
int uk[350];
int sz[350];
int a[100100];
int b[100100];
pair<pair<int, int>, pair<int, int> > c[100100];
int res[100100];
int main() {
  scanf("%d%d", &n, &q);
  int d = 1;
  while (d * d < n) d++;
  int bl = n / d;
  if ((n % d) != 0) bl++;
  for (int i = (0); i < (n); ++i) scanf("%d%d", &a[i], &b[i]);
  for (int i = (0); i < (bl); ++i) {
    int l = i * d;
    int r = ((n) < (d * (i + 1)) ? (n) : (d * (i + 1)));
    int max1 = 0;
    int v = -1;
    for (int j = (l); j < (r); ++j) {
      if (a[j] > max1) {
        v = j;
        max1 = a[j];
      } else if ((a[j] == max1) && (b[j] > b[v]))
        v = j;
    }
    sz[i]++;
    best[i][0] = make_pair(0, v);
    double curt = 0;
    while (1) {
      double min1 = 2000000000;
      int bv = -1;
      for (int j = (l); j < (r); ++j) {
        if (b[j] == b[v]) continue;
        double t = (a[v] - a[j]) / (double(b[j] - b[v]));
        if ((t > curt) && (t < min1)) {
          min1 = t;
          bv = j;
        } else if ((((t - min1) > (0) ? (t - min1) : (-(t - min1))) < eps) &&
                   (b[j] > b[bv]))
          bv = j;
      }
      if (bv == -1) break;
      best[i][sz[i]] = make_pair(min1, bv);
      v = bv;
      curt = min1;
      sz[i]++;
    }
  }
  for (int i = (0); i < (q); ++i) {
    scanf("%d%d%d", &c[i].second.first, &c[i].second.second, &c[i].first.first);
    c[i].first.second = i;
  }
  sort(c, c + q);
  for (int i = (0); i < (q); ++i) {
    int l = c[i].second.first;
    l--;
    int r = c[i].second.second;
    r--;
    int v = c[i].first.second;
    int t = c[i].first.first;
    int num1 = l / d;
    int k = (((num1 + 1) * d) < (r + 1) ? ((num1 + 1) * d) : (r + 1));
    long long max1 = -1;
    int ress = -1;
    for (int j = (l); j < (k); ++j)
      if (a[j] + b[j] * 1ll * t > max1) {
        max1 = a[j] + b[j] * 1ll * t;
        ress = j;
      }
    int num2 = r / d;
    k = (((num2 - 1) * d) > (l) ? ((num2 - 1) * d) : (l));
    for (int j = (k); j < (r + 1); ++j)
      if (a[j] + b[j] * 1ll * t > max1) {
        max1 = a[j] + b[j] * 1ll * t;
        ress = j;
      }
    for (int j = (num1 + 1); j < (num2); ++j) {
      while (1) {
        if ((uk[j] == sz[j] - 1) || (best[j][uk[j] + 1].first > t)) {
          int vv = best[j][uk[j]].second;
          if (a[vv] + b[vv] * 1ll * t > max1) {
            max1 = a[vv] + b[vv] * 1ll * t;
            ress = vv;
          }
          break;
        } else
          uk[j]++;
      }
    }
    res[v] = ress;
  }
  for (int i = (0); i < (q); ++i) printf("%d\n", res[i] + 1);
  return 0;
}