int query(int u, int l, int r, double k) {
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 1e5 + 10;
const double eps = 1e-6;
int n, m, tot;
double a[maxn], b[maxn], c[maxn];
vector<int> tr[maxn << 2];
void pushup(int u) {
int ls = u << 1, rs = u << 1 | 1;
for (int i = 0, j = 0; i < tr[ls].size() || j < tr[rs].size();) {
if (i == tr[ls].size()) tr[u].push_back(tr[rs][j++]);
else if (j == tr[rs].size() || a[tr[ls][i]] - b[tr[ls][i]] < a[tr[rs][j]] - b[tr[rs][j]]) {
tr[u].push_back(tr[ls][i++]);
} else {
tr[u].push_back(tr[rs][j++]);
}
}
}
void build(int u, int l, int r) {
tr[u].clear();
if (l + 1 == r) {
tr[u].push_back(l);
return;
}
int mid = (l + r) >> 1;
build(u << 1, l, mid);
build(u << 1 | 1, mid, r);
pushup(u);
}
void modify(int u, int l, int r, int pos, int val) {
if (l + 1 == r) {
tr[u].push_back(pos);
return;
}
int mid = (l + r) >> 1;
if (mid > pos) modify(u << 1, l, mid, pos, val);
else modify(u << 1 | 1, mid, r, pos, val);
pushup(u);
}
int query(int u, int l, int r, double k) {
if (tr[u].empty()) return -1;
if (l + 1 == r) return tr[u][0];
int mid = (l + r) >> 1, ans = -1;
for (int i = 0; i < tr[u].size(); ++i) {
int p = tr[u][i];
c[p] = a[p] * k - b[p];
if (c[p] > c[ans]) ans = p;
}
if (ans != -1) return ans;
if (k < eps) return -1;
if (!tr[u << 1].empty() && a[tr[u << 1][0]] > b[tr[u << 1][0]] / k) {
ans = query(u << 1, l, mid, k);
}
if (ans == -1 && !tr[u << 1 | 1].empty() && a[tr[u << 1 | 1][0]] > b[tr[u << 1 | 1][0]] / k) {
ans = query(u << 1 | 1, mid, r, k);
}