#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
class Node {
 public:
  long long key, pr, s;
  long long mn, mx, smx, d, dmn;
  Node *l, *r;
  Node() {}
  Node(long long key, long long s)
      : key(key),
        s(s),
        mn(key),
        pr((rand() + (RAND_MAX + 1) * rand())),
        mx(key),
        smx(s),
        d(0),
        dmn(0),
        l(nullptr),
        r(nullptr) {}
};
typedef Node *DTree;
long long getMin(DTree t) {
  if (!t) return 1500000000;
  return t->mn;
}
long long getMax(DTree t) {
  if (!t) return 0;
  return t->mx;
}
long long getSMax(DTree t) {
  if (!t) return 0;
  return t->smx;
}
long long getD(DTree t) {
  if (!t) return 0;
  return t->d;
}
long long getDMin(DTree t) {
  if (!t) return 0;
  return t->dmn;
}
void update(DTree t) {
  if (!t) return;
  t->mn = min(t->key, getMin(t->l));
  t->mx = max(t->key, getMax(t->r));
  if (t->key > getMax(t->r))
    t->smx = t->s;
  else
    t->smx = getSMax(t->r);
  long long d = 0, dmn = 0;
  dmn = min(dmn, getDMin(t->l));
  d = getD(t->l) + getSMax(t->l) * (t->key - getMax(t->l));
  dmn = min(dmn, d);
  d += (t->r ? t->s * (getMin(t->r) - t->key) : 0);
  dmn = min(dmn, d + getDMin(t->r));
  d += getD(t->r);
  dmn = min(dmn, d);
  t->d = d;
  t->dmn = dmn;
}
void split(DTree t, DTree &l, DTree &r, long long key) {
  if (!t) {
    l = r = nullptr;
    return;
  }
  if (key < t->key)
    split(t->l, l, t->l, key), r = t;
  else
    split(t->r, t->r, r, key), l = t;
  update(t);
}
void merge(DTree &t, DTree l, DTree r) {
  if (!l || !r) {
    t = (l ? l : r);
    return;
  }
  if (l->pr > r->pr)
    merge(l->r, l->r, r), t = l;
  else
    merge(r->l, l, r->l), t = r;
  update(t);
}
void insert(DTree &t, long long key, long long s) {
  DTree tl, tm = new Node(key, s), tr;
  split(t, tl, tr, key);
  merge(t, tl, tm);
  merge(t, t, tr);
}
void erase(DTree &t, long long key) {
  DTree tl, tm, tr;
  split(t, tl, tm, key - 1);
  split(tm, tm, tr, key);
  merge(t, tl, tr);
}
double getAns(DTree t, long long r, long long v) {
  if (!t) return -1;
  if (t->dmn + v > 0)
    return (t->smx >= 0 || t->mx * t->smx - (t->d + v) < r * t->smx
                ? -1
                : t->mx - (long double)(t->d + v) / t->smx);
  long long dl = getDMin(t->l);
  long long d = getD(t->l) + getSMax(t->l) * (t->key - getMax(t->l));
  long long dr = d + (t->r ? t->s * (getMin(t->r) - t->key) : 0);
  if (dl + v <= 0) return getAns(t->l, r, v);
  if (d + v <= 0)
    return getMax(t->l) - (long double)(v + getD(t->l)) / getSMax(t->l);
  if (dr + v <= 0) return t->key - (long double)(v + d) / t->s;
  return getAns(t->r, r, v + dr);
}
double getAns(DTree t, long long l, long long r, long long v) {
  if (!v) return l;
  DTree tl, tm, tr;
  split(t, tl, tm, l - 1);
  split(tm, tm, tr, r);
  double ans = getAns(tm, r, v);
  merge(t, tl, tm);
  merge(t, t, tr);
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  DTree t = nullptr;
  int n;
  cin >> n;
  for (int i = 0; i < int(n); i++) {
    int q;
    cin >> q;
    if (q == 1) {
      long long key, s;
      cin >> key >> s;
      insert(t, key, s);
    }
    if (q == 2) {
      long long key;
      cin >> key;
      erase(t, key);
    }
    if (q == 3) {
      long long l, r, v;
      cin >> l >> r >> v;
      cout << setprecision(20) << getAns(t, l, r, v) << '\n';
    }
  }
}
