#include <bits/stdc++.h>
using namespace std;
int Rand() { return (rand() << 10) ^ rand(); }
const int SZ = 300;
const int MAX = 100010;
struct Block {
  long long add, start, end;
  int type;
  Block(long long _add, long long _start, long long _end, int _type) {
    add = _add;
    start = _start;
    end = _end;
    type = _type;
  }
  double Zeroes(long long v) {
    if (v + (end - start + 1) * add <= 0) {
      return start + (v + 0.0) / abs(add);
    } else {
      return -1;
    }
  }
  long long Min(long long v) { return min(v, v + (end - start + 1) * add); }
  long long AtEnd(long long v) { return v + (end - start + 1) * add; }
};
long long minv[MAX], at_end[MAX];
list<Block>::iterator lo[MAX], hi[MAX];
map<int, list<Block>::iterator> loc;
list<Block> arr;
void Init() { loc[0] = arr.insert(arr.begin(), Block(0, 0, 1E9 + 10, -1)); }
void RebuildBlock(list<Block>::iterator pos) {
  int id = pos->type;
  lo[id] = hi[id] = pos;
  while (lo[id] != arr.begin() && (--list<Block>::iterator(lo[id]))->type == id)
    --lo[id];
  while ((++list<Block>::iterator(hi[id])) != arr.end() &&
         (++list<Block>::iterator(hi[id]))->type == id)
    ++hi[id];
  long long val = 0;
  minv[id] = val;
  pos = lo[id];
  do {
    (minv[id]) = min((minv[id]), (pos->Min(val)));
    val = pos->AtEnd(val);
    if (pos == hi[id]) break;
    ++pos;
  } while (true);
  at_end[id] = val;
}
void Build() {
  int cid = -1;
  list<Block>::iterator pos = arr.begin();
  while (pos != arr.end()) {
    ++cid;
    for (int i = 0; i < SZ && pos != arr.end(); ++i) {
      pos->type = cid;
      ++pos;
    }
  }
  cid = -1;
  pos = arr.begin();
  for (; pos != arr.end(); ++pos)
    if (cid != pos->type) {
      RebuildBlock(pos);
      pos = hi[pos->type];
    }
}
void Delete(int t) {
  list<Block>::iterator it = loc[t];
  int me = it->type;
  list<Block>::iterator par = it;
  --par;
  par->end = it->end;
  arr.erase(it);
  loc.erase(t);
  RebuildBlock(par);
  ++par;
  if (par != arr.end() && me == par->type) RebuildBlock(par);
}
void Insert(int t, long long add) {
  auto it = loc.lower_bound(t);
  --it;
  list<Block>::iterator sp = it->second;
  Block neo(add, t, sp->end, sp->type);
  sp->end = t - 1;
  loc[t] = arr.insert(++sp, neo);
  RebuildBlock(loc[t]);
}
double FirstZero(int l, int r, long long v) {
  if (v == 0) return l;
  auto start = loc.lower_bound(l);
  if (start == loc.end()) {
    if (v == 0) return l;
    return -1;
  }
  list<Block>::iterator pos = start->second;
  int fg = pos->type;
  long long bal = v;
  while (true) {
    if (pos == arr.end()) return -1;
    if (pos->start > r) return -1;
    if (pos->type != fg) {
      int id = pos->type;
      if (minv[id] + bal > 0) {
        fg = pos->type;
        bal = at_end[id] + bal;
        pos = hi[id];
        ++pos;
        continue;
      }
    }
    double zp = pos->Zeroes(bal);
    if (zp > -0.5 && zp < r + 1E-9) return zp;
    bal = pos->AtEnd(bal);
    fg = pos->type;
    ++pos;
  }
}
int main() {
  Init();
  Build();
  int n = 100000;
  scanf("%d", &n);
  int mods = 0;
  for (int i = 0; i < n; ++i) {
    if (mods % SZ == SZ - 1) Build();
    int op;
    scanf("%d", &op);
    if (op == 1) {
      ++mods;
      int t, s;
      scanf("%d%d", &t, &s);
      Insert(t, s);
    } else if (op == 2) {
      int t;
      scanf("%d", &t);
      Delete(t);
    } else if (op == 3) {
      int l, r, v;
      scanf("%d%d%d", &l, &r, &v);
      double res = FirstZero(l, r, v);
      if (res < -0.5)
        printf("-1\n");
      else
        printf("%.12f\n", res);
    }
  }
  return 0;
}
