#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1000005;
long long i, i0, n, m;
vector<long long> v;
struct node {
  long long siz, v, sum, mp;
} tree[maxn * 4];
node operator+(node a, node b) {
  node c;
  c.siz = a.siz + b.siz;
  c.v = (int)1e9 + 7;
  c.sum = a.sum + b.sum;
  c.mp = min(a.mp, a.sum + b.mp);
  return c;
}
void b_tree(long long l, long long r, long long p) {
  if (l == r)
    tree[p] = {((l == v.size()) ? 0 : (v[l] - v[l - 1])), 0, 0, 0};
  else {
    b_tree(l, (l + r) / 2, p * 2), b_tree((l + r) / 2 + 1, r, p * 2 + 1);
    tree[p] = tree[p * 2] + tree[p * 2 + 1];
  }
}
void p_tree(long long p) {
  if (tree[p].v == (int)1e9 + 7) return;
  tree[p * 2] = {tree[p * 2].siz, tree[p].v, tree[p * 2].siz * tree[p].v,
                 min(0ll, tree[p * 2].siz * tree[p].v)};
  tree[p * 2 + 1] = {tree[p * 2 + 1].siz, tree[p].v,
                     tree[p * 2 + 1].siz * tree[p].v,
                     min(0ll, tree[p * 2 + 1].siz * tree[p].v)};
  tree[p].v = (int)1e9 + 7;
}
void c_tree(long long l, long long r, long long p, long long a, long long b,
            long long v) {
  if (l == a && r == b)
    tree[p] = {tree[p].siz, v, tree[p].siz * v, min(0ll, tree[p].siz * v)};
  else {
    p_tree(p);
    if (b <= (l + r) / 2)
      c_tree(l, (l + r) / 2, p * 2, a, b, v);
    else if (a >= (l + r) / 2 + 1)
      c_tree((l + r) / 2 + 1, r, p * 2 + 1, a, b, v);
    else
      c_tree(l, (l + r) / 2, p * 2, a, (l + r) / 2, v),
          c_tree((l + r) / 2 + 1, r, p * 2 + 1, (l + r) / 2 + 1, b, v);
    tree[p] = tree[p * 2] + tree[p * 2 + 1];
  }
}
long long q_tree(long long l, long long r, long long p, long long a) {
  if (l == r)
    return tree[p].v;
  else {
    p_tree(p);
    if (a <= (l + r) / 2)
      return q_tree(l, (l + r) / 2, p * 2, a);
    else
      return q_tree((l + r) / 2 + 1, r, p * 2 + 1, a);
    tree[p] = tree[p * 2] + tree[p * 2 + 1];
  }
}
long long gsz;
double q0_tree(long long l, long long r, long long p, long long a, long long b,
               long long v) {
  double ans = 1e9 + 7;
  if (l == a && r == b) {
    if (l != r) p_tree(p);
    if (v + tree[p].mp + gsz <= 0) {
      if (l != r) {
        ans = q0_tree(l, (l + r) / 2, p * 2, l, (l + r) / 2, v);
        if (ans > 1e9 + 6)
          ans = tree[p * 2].siz +
                q0_tree((l + r) / 2 + 1, r, p * 2 + 1, (l + r) / 2 + 1, r, v);
      } else
        ans = (double)(-v - gsz) / tree[p].v;
    } else
      gsz += tree[p].sum;
    if (l != r) tree[p] = tree[p * 2] + tree[p * 2 + 1];
  } else {
    p_tree(p);
    if (b <= (l + r) / 2)
      ans = q0_tree(l, (l + r) / 2, p * 2, a, b, v);
    else if (a >= (l + r) / 2 + 1)
      ans = tree[p * 2].siz + q0_tree((l + r) / 2 + 1, r, p * 2 + 1, a, b, v);
    else {
      ans = q0_tree(l, (l + r) / 2, p * 2, a, (l + r) / 2, v);
      if (ans > 1e9 + 6)
        ans = tree[p * 2].siz +
              q0_tree((l + r) / 2 + 1, r, p * 2 + 1, (l + r) / 2 + 1, b, v);
    }
    tree[p] = tree[p * 2] + tree[p * 2 + 1];
  }
  return ans;
}
struct op {
  long long op, t, l, r, v, s;
} a[100005];
void cal(long long &t) {
  t = lower_bound(v.begin(), v.end(), t) - v.begin() + 1;
}
set<long long> s;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i].op);
    if (a[i].op == 1) scanf("%d %lld", &a[i].t, &a[i].s), v.push_back(a[i].t);
    if (a[i].op == 2) scanf("%d", &a[i].t), v.push_back(a[i].t);
    if (a[i].op == 3)
      scanf("%d %d %lld", &a[i].l, &a[i].r, &a[i].v), v.push_back(a[i].l),
          v.push_back(a[i].r);
  }
  v.push_back(0), v.push_back((long long)1e9 + 7);
  sort(v.begin(), v.end()), v.erase(unique(v.begin(), v.end()), v.end());
  long long ll = 1, rr = v.size();
  b_tree(ll, rr, 1);
  s.insert(ll), s.insert(rr);
  for (i = 1; i <= n; i++) {
    if (a[i].op == 1) {
      cal(a[i].t);
      auto it = s.upper_bound(a[i].t);
      c_tree(ll, rr, 1, a[i].t, *it - 1, a[i].s);
      s.insert(a[i].t);
    }
    if (a[i].op == 2) {
      cal(a[i].t);
      auto it = s.upper_bound(a[i].t);
      a[i].r = *it, a[i].l = *(-- --it);
      a[i].s = q_tree(ll, rr, 1, a[i].l);
      c_tree(ll, rr, 1, a[i].l, a[i].r - 1, a[i].s);
      s.erase(a[i].t);
    }
    if (a[i].op == 3) {
      gsz = 0;
      double ans = a[i].l;
      cal(a[i].l), cal(a[i].r);
      a[i].l = *s.lower_bound(a[i].l);
      if (a[i].r - 1 < a[i].l) {
        if (a[i].v) ans = -1;
      } else {
        if (a[i].v) ans = q0_tree(ll, rr, 1, a[i].l, a[i].r - 1, a[i].v);
        if (ans > 1e9 + 6) ans = -1;
      }
      printf("%.7f\n", ans);
    }
  }
  return 0;
}
