#include <bits/stdc++.h>
using namespace std;
struct node {
  long long t;
  long long v;
  long long sum;
  long long l, lv, rv, r;
  long long pre;
  void merge(node a, node b) {
    long long e1 = (t - a.r) * a.rv, e2 = (b.l - t) * v;
    sum = a.sum + b.sum + e1 + e2;
    l = a.l, lv = a.lv, r = b.r, rv = b.rv;
    pre = min(a.pre, a.sum + min(e1, min(e1 + e2, e1 + e2 + b.pre)));
  }
  void mergel(node a) {
    long long e1 = (t - a.r) * a.rv;
    sum = a.sum + e1;
    l = a.l, lv = a.lv;
    r = t, rv = v;
    pre = min(a.pre, a.sum + e1);
  }
  void merger(node b) {
    long long e2 = (b.l - t) * v;
    sum = b.sum + e2;
    l = t, lv = v;
    r = b.r, rv = b.rv;
    pre = e2 + min(0ll, b.pre);
    pre = min(0ll, pre);
  }
  void modify() {
    l = r = t;
    lv = rv = v;
    pre = 0, sum = 0;
  }
  void set(int tt, int vv) {
    t = tt, v = vv;
    modify();
  }
};
struct splaytree {
  node tree[300008];
  int rt;
  int tot;
  int ch[300008][2];
  int pa[300008];
  void up(int x) {
    ch[0][0] = ch[0][1] = 0;
    if (!x) return;
    if (!ch[x][0] and !ch[x][1])
      tree[x].modify();
    else if (!ch[x][0])
      tree[x].merger(tree[ch[x][0] + ch[x][1]]);
    else if (!ch[x][1])
      tree[x].mergel(tree[ch[x][0] + ch[x][1]]);
    else
      tree[x].merge(tree[ch[x][0]], tree[ch[x][1]]);
  }
  void rotate(int x) {
    int y = pa[x], z = pa[y];
    ch[z][ch[z][1] == y] = x;
    int d = ch[y][1] == x;
    int c = ch[x][d ^ 1];
    ch[x][d ^ 1] = y, ch[y][d] = c;
    pa[c] = y, pa[y] = x, pa[x] = z;
    up(y), up(x), up(z);
  }
  void splay(int x, int goal) {
    while (pa[x] != goal) {
      int y = pa[x], z = pa[y];
      if (z == goal)
        rotate(x);
      else {
        if ((ch[y][1] == x) ^ (ch[z][1] == y))
          rotate(x), rotate(x);
        else
          rotate(y), rotate(x);
      }
    }
    if (goal == 0) rt = x;
  }
  int find(int t) {
    int x = rt;
    int f = 0;
    while (1) {
      if (!x) {
        splay(f, 0);
        return -1;
      }
      if (tree[x].t == t) {
        splay(x, 0);
        return x;
      }
      f = x;
      if (t < tree[x].t)
        x = ch[x][0];
      else
        x = ch[x][1];
    }
  }
  void insert(int t, int v) {
    int x = rt;
    int f = 0;
    while (1) {
      if (!x) break;
      f = x;
      if (t < tree[x].t)
        x = ch[x][0];
      else
        x = ch[x][1];
    }
    x = ++tot;
    tree[x].set(t, v);
    up(x);
    pa[x] = f, ch[f][t > tree[f].t] = x;
    splay(x, 0);
  }
  int next(int x, int f) {
    assert(rt == x);
    x = ch[x][f];
    while (1) {
      if (ch[x][!f])
        x = ch[x][!f];
      else
        return x;
    }
  }
  void erase(int t) {
    int x = find(t);
    splay(x, 0);
    int l = next(x, 0), r = next(x, 1);
    splay(l, 0);
    splay(r, l);
    ch[r][0] = 0;
    up(r);
    up(l);
  }
  double query(int x, long long bef) {
    if (tree[x].pre + bef > 0) return -1;
    if (bef == 0) return tree[x].l;
    if (tree[ch[x][0]].pre + bef <= 0) return query(ch[x][0], bef);
    bef += tree[ch[x][0]].sum;
    if (ch[x][0]) {
      long long e1 = (tree[x].t - tree[ch[x][0]].r) * tree[ch[x][0]].rv;
      if (e1 + bef <= 0)
        return tree[ch[x][0]].r - 1.0 * bef / tree[ch[x][0]].rv;
      bef += e1;
    }
    if (ch[x][1]) {
      long long e2 = (tree[ch[x][1]].l - tree[x].t) * tree[x].v;
      if (e2 + bef <= 0) return tree[x].t - 1.0 * bef / tree[x].v;
      bef += e2;
    }
    return query(ch[x][1], bef);
  }
  double query(int l, int r, long long bef) {
    int tl = 0, tr = 0;
    if (find(l) == -1) insert(l, 0), tl = 1;
    if (find(r) == -1) insert(r, 0), tr = 1;
    l = find(l), r = find(r);
    int cl = l, cr = r;
    splay(l, 0), l = next(l, 0);
    splay(r, 0), r = next(r, 1);
    splay(l, 0);
    splay(r, l);
    double ct = query(ch[r][0], bef);
    if (tl) erase(tree[cl].t);
    if (tr) erase(tree[cr].t);
    return ct;
  }
  void init() {
    tot = 2;
    tree[1].set(0, 0);
    tree[2].set(1000000007, 0);
    ch[1][1] = 2, pa[2] = 1;
    up(2);
    up(1);
    rt = 1;
  }
} trcyx;
int Q;
int main() {
  scanf("%d", &Q);
  trcyx.init();
  while (Q--) {
    int ctrl;
    scanf("%d", &ctrl);
    if (ctrl == 1) {
      int t, v;
      scanf("%d%d", &t, &v);
      trcyx.insert(t, v);
    } else if (ctrl == 2) {
      int t;
      scanf("%d", &t);
      trcyx.erase(t);
    } else {
      int l, r, bef;
      scanf("%d%d%d", &l, &r, &bef);
      printf("%.12lf\n", trcyx.query(l, r, bef));
    }
  }
  return 0;
}
