#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
struct node {
  int k, t;
  long long s, mxs;
};
node operator+(node t1, node t2) {
  node tmp;
  tmp.k = t2.k;
  tmp.s = t1.s + t2.s;
  tmp.t = t1.t + t2.t;
  tmp.mxs = max(t1.mxs, t2.mxs + t1.s);
  return tmp;
}
struct tree {
  int fat, ch[2], k, t, len;
  node a;
  node pre() { return (node){k, len, 1ll * k * len, max(1ll * k * len, 0ll)}; }
} t[N];
int rt, tot;
void pushup(int x) {
  t[x].a = t[(t[x].ch[0])].a + t[x].pre() + t[(t[x].ch[1])].a;
}
void rotate(int x) {
  int y = t[x].fat, z = t[y].fat, k = t[y].ch[1] == x;
  if (z) t[z].ch[t[z].ch[1] == y] = x;
  t[x].fat = z;
  t[y].ch[k] = t[x].ch[k ^ 1];
  if (t[x].ch[k ^ 1]) t[t[x].ch[k ^ 1]].fat = y;
  t[x].ch[k ^ 1] = y;
  t[y].fat = x;
  pushup(y);
  pushup(x);
}
void splay(int x, int go) {
  while (t[x].fat != go) {
    int y = t[x].fat, z = t[y].fat;
    if (z != go) (t[y].ch[0] == x) ^ (t[z].ch[0] == y) ? rotate(x) : rotate(y);
    rotate(x);
  }
  if (!go) rt = x;
}
void insert(int a, int s) {
  int x = rt, f = 0;
  while (1) {
    if (t[x].t > a)
      f = x, x = (t[x].ch[0]);
    else
      f = x, x = (t[x].ch[1]);
    if (!x) break;
  }
  int k = t[f].t < a;
  x = ++tot;
  if (f) t[f].ch[k] = x;
  t[x].fat = f;
  t[x].t = a;
  t[x].k = s;
  splay(x, 0);
}
int nxt(int a, int p) {
  int x = rt, u = 0;
  bool fl = 0;
  while (1) {
    if (t[x].t == a) {
      fl = 1;
      break;
    }
    int k = t[x].t < a;
    if (p ^ k) u = x;
    if (!t[x].ch[k]) break;
    x = t[x].ch[k];
  }
  if (!fl) return u;
  if (!t[x].ch[p])
    return u;
  else
    x = t[x].ch[p];
  while (t[x].ch[p ^ 1]) x = t[x].ch[p ^ 1];
  return x;
}
void add(int a, int s) {
  insert(a, s);
  int nw = tot, lt = nxt(a, 0), nt = nxt(a, 1);
  splay(lt, 0);
  t[lt].len = a - t[lt].t;
  pushup(lt);
  splay(nw, 0);
  t[nw].len = t[nt].t - a;
  pushup(nw);
}
void del(int a) {
  int ul = nxt(a, 0), ur = nxt(a, 1);
  splay(ul, 0);
  splay(ur, ul);
  t[ur].ch[0] = 0;
  pushup(ur);
  t[ul].len = t[ur].t - t[ul].t;
  pushup(ul);
}
double query(int l, int r, long long v) {
  if (!v) return l;
  int ul = nxt(l, 0), ur = nxt(r, 1), tmp;
  splay(ul, 0);
  splay(ur, ul);
  int nw = t[ur].ch[0];
  tmp = nw;
  if (t[nw].a.mxs < v) return -1;
  while (t[tmp].ch[0]) tmp = t[tmp].ch[0];
  int u = nw;
  node now = (node){0, 0, 0, 0};
  while (1) {
    node pre = now + t[t[u].ch[0]].a + t[u].pre();
    if (pre.mxs < v)
      now = pre, u = t[u].ch[1];
    else {
      node temp = now + t[t[u].ch[0]].a;
      if (temp.mxs < v) return 1.0 * (v - temp.s) / t[u].k + t[u].t;
      u = t[u].ch[0];
    }
    if (!u) return -1;
  }
}
int main() {
  insert(0, 0);
  insert(2e9 + 1, 0);
  int T;
  scanf("%d", &T);
  while (T--) {
    int opt, x;
    scanf("%d", &opt);
    if (opt == 1) {
      int a, s;
      scanf("%d%d", &a, &s);
      add(a, -s);
    } else if (opt == 2)
      scanf("%d", &x), del(x);
    else {
      int l, r, v;
      scanf("%d%d%d", &l, &r, &v);
      double s = query(l, r, v);
      if (s > r)
        printf("-1\n");
      else
        printf("%.10lf\n", s);
    }
  }
}
