#include <bits/stdc++.h>
using namespace std;
int Q;
const int MAX_Q = 1e5, BUC = 448;
long long INF = 1e9 + 32;
long long buk[448][4];
vector<int> tim;
int typ[MAX_Q], T[MAX_Q], L[MAX_Q], R[MAX_Q];
long long V[MAX_Q];
long long S[MAX_Q];
long long spd[MAX_Q * 2];
int main() {
  scanf("%d", &Q);
  for (int i = (0); i < (Q); ++i) {
    scanf("%d", typ + i);
    switch (typ[i]) {
      case 1:
        scanf("%d %I64d", T + i, S + i);
        break;
      case 2:
        scanf("%d", T + i);
        break;
      case 3:
        scanf("%d %d %I64d", L + i, R + i, V + i);
    }
    if (typ[i] <= 2) {
      tim.push_back(T[i]);
    } else {
      tim.push_back(L[i]);
      tim.push_back(R[i]);
    }
  }
  sort(tim.begin(), tim.end());
  tim.erase(unique(tim.begin(), tim.end()), tim.end());
  for (int i = (0); i < (Q); ++i) {
    if (typ[i] <= 2) {
      T[i] = lower_bound(tim.begin(), tim.end(), T[i]) - tim.begin();
    } else {
      L[i] = lower_bound(tim.begin(), tim.end(), L[i]) - tim.begin();
      R[i] = lower_bound(tim.begin(), tim.end(), R[i]) - tim.begin();
    }
  }
  for (int i = (0); i < (448); ++i) {
    buk[i][2] = (i + 1) * BUC;
    buk[i][3] = INF;
  }
  for (int i = (0); i < ((int)tim.size()); ++i) {
    spd[i] = INF;
  }
  for (int q = (0); q < (Q); ++q) {
    switch (typ[q]) {
      case 1:
        spd[T[q]] = S[q];
        break;
      case 2:
        spd[T[q]] = INF;
        break;
      case 3:
        long long s = 0, v = V[q];
        int l = L[q];
        double ans;
        if (v == 0) {
          ans = tim[l];
          goto LAB;
        }
        while (l < R[q] && l % BUC > 0) {
          if (spd[l] != INF) {
            s = spd[l];
          }
          if (v + s * (tim[l + 1] - tim[l]) <= 0) {
            ans = -(double)v / s + tim[l];
            goto LAB;
          }
          v += s * (tim[l + 1] - tim[l]);
          l++;
        }
        while (l + BUC < R[q]) {
          if (v + s * (tim[buk[l / BUC][2]] - tim[l]) <= 0) {
            ans = -(double)v / s + tim[l];
            goto LAB;
          }
          v += s * (tim[buk[l / BUC][2]] - tim[l]);
          if (buk[l / BUC][2] - l < BUC) {
            l = buk[l / BUC][2];
            if (v + buk[l / BUC][0] <= 0) {
              break;
            }
            v += buk[l / BUC][1];
          }
          if (buk[l / BUC][3] != INF) {
            s = buk[l / BUC][3];
          }
          l = (l / BUC + 1) * BUC;
        }
        while (l < R[q]) {
          if (spd[l] != INF) {
            s = spd[l];
          }
          if (v + s * (tim[l + 1] - tim[l]) <= 0) {
            ans = -(double)v / s + tim[l];
            goto LAB;
          }
          v += s * (tim[l + 1] - tim[l]);
          l++;
        }
        assert(v > 0 && l == R[q]);
        ans = -1;
      LAB:
        printf("%.16f\n", ans);
    }
    if (typ[q] <= 2) {
      int l = T[q] / BUC * BUC, r = l + BUC;
      if (T[q] / BUC != ((int)tim.size() - 1) / BUC) {
        while (l < r && spd[l] == INF) {
          l++;
        }
        buk[T[q] / BUC][2] = l;
        long long v = 0, s = 0;
        buk[T[q] / BUC][0] = 0;
        buk[T[q] / BUC][3] = INF;
        while (l < r) {
          if (spd[l] != INF) {
            s = spd[l];
            buk[T[q] / BUC][3] = s;
          }
          v += s * (tim[l + 1] - tim[l]);
          buk[T[q] / BUC][0] = min(buk[T[q] / BUC][0], v);
          l++;
        }
        buk[T[q] / BUC][1] = v;
      }
    }
  }
}
