#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3f;
vector<pair<pair<int, int>, pair<int, int> > > q;
vector<int> all;
int get_id(int x) {
  return lower_bound(all.begin(), all.end(), x) - all.begin();
}
struct Segment_tree {
  struct Node {
    long long sum, minj;
    long long lazy;
    Node() { sum = 0, minj = 0, lazy = 0; }
  } T[1600010];
  void pushup(int now) {
    T[now].sum = T[now << 1].sum + T[now << 1 | 1].sum;
    T[now].minj = min(T[now << 1].minj, T[now << 1 | 1].minj + T[now << 1].sum);
  }
  Node merge(Node a, Node b) {
    Node ans;
    ans.sum = a.sum + b.sum, ans.minj = min(a.minj, a.sum + b.minj);
    return ans;
  }
  void pushdown(int now, int l, int r) {
    int mid = l + r >> 1;
    if (T[now].lazy == INF) return;
    long long v = T[now].lazy;
    T[now].lazy = INF;
    T[now << 1].sum = v * (all[mid + 1] - all[l]), T[now << 1].lazy = v;
    T[now << 1 | 1].sum = v * (all[r + 1] - all[mid + 1]),
                 T[now << 1 | 1].lazy = v;
    T[now << 1].minj = v >= 0 ? v * (all[l + 1] - all[l]) : T[now << 1].sum;
    T[now << 1 | 1].minj =
        v >= 0 ? v * (all[mid + 2] - all[mid + 1]) : T[now << 1 | 1].sum;
  }
  void Build(int now, int l, int r) {
    T[now].lazy = INF;
    if (l == r) {
      T[now].sum = 0, T[now].minj = 0;
      return;
    }
    int mid = l + r >> 1;
    Build(now << 1, l, mid), Build(now << 1 | 1, mid + 1, r);
    pushup(now);
  }
  void Update(int now, int l, int r, int L, int R, long long v) {
    if (l == L && r == R) {
      T[now].sum = (all[r + 1] - all[l]) * v;
      T[now].minj = v >= 0 ? (all[l + 1] - all[l]) * v : T[now].sum;
      T[now].lazy = v;
      return;
    }
    pushdown(now, l, r);
    int mid = l + r >> 1;
    if (R <= mid)
      Update(now << 1, l, mid, L, R, v);
    else if (L > mid)
      Update(now << 1 | 1, mid + 1, r, L, R, v);
    else
      Update(now << 1, l, mid, L, mid, v),
          Update(now << 1 | 1, mid + 1, r, mid + 1, R, v);
    pushup(now);
  }
  Node Query(int now, int l, int r, int L, int R) {
    if (L > R) return Node();
    if (l == L && r == R) return T[now];
    pushdown(now, l, r);
    int mid = l + r >> 1;
    if (R <= mid) return Query(now << 1, l, mid, L, R);
    if (L > mid) return Query(now << 1 | 1, mid + 1, r, L, R);
    return merge(Query(now << 1, l, mid, L, mid),
                 Query(now << 1 | 1, mid + 1, r, mid + 1, R));
  }
} seg1;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int op;
    scanf("%d", &op);
    pair<pair<int, int>, pair<int, int> > x;
    x.first.first = op;
    if (op == 1)
      scanf("%d%d", &x.second.first, &x.second.second),
          all.push_back(x.second.first);
    else if (op == 2)
      scanf("%d", &x.first.second), all.push_back(x.first.second);
    else
      scanf("%d%d%d", &x.second.first, &x.second.second, &x.first.second),
          all.push_back(x.second.first), all.push_back(x.second.second);
    q.push_back(x);
  }
  sort(all.begin(), all.end()),
      all.resize(unique(all.begin(), all.end()) - all.begin());
  int m = all.size() - 2;
  if (m >= 0) seg1.Build(1, 0, m);
  set<int> now;
  for (int i = 0; i < n; i++) {
    int op = q[i].first.first;
    if (op == 1)
      q[i].second.first = get_id(q[i].second.first);
    else if (op == 2)
      q[i].first.second = get_id(q[i].first.second);
    else
      q[i].second.first = get_id(q[i].second.first),
      q[i].second.second = get_id(q[i].second.second);
    if (op == 1) {
      int t = q[i].second.first, s = q[i].second.second;
      if (t == all.size() - 1) continue;
      set<int>::iterator it = now.upper_bound(t);
      int last = it == now.end() ? all.size() - 1 : *it;
      seg1.Update(1, 0, m, t, last - 1, s);
      now.insert(t);
    } else if (op == 2) {
      int t = q[i].first.second;
      if (t == all.size() - 1) continue;
      set<int>::iterator it = now.lower_bound(t);
      if (it == now.end() || *it != t) continue;
      it++;
      int last = it == now.end() ? all.size() - 1 : *it;
      it--;
      int first = 0;
      long long v = 0;
      if (it != now.begin()) {
        it--, first = *it;
        v = seg1.Query(1, 0, m, first, first).sum /
            (all[first + 1] - all[first]);
      }
      seg1.Update(1, 0, m, first, last - 1, v);
      now.erase(t);
    } else {
      int l = q[i].second.first, r = q[i].second.second, v = q[i].first.second;
      set<int>::iterator it = now.lower_bound(l);
      int from = -1, to = all.size() - 2;
      long long val = -1;
      int pos, le, ri;
      long long sum, k;
      if (it != now.end()) to = *it - 1;
      if (it != now.begin()) {
        it--, from = *it;
        val = seg1.Query(1, 0, m, from, from).sum / (all[from + 1] - all[from]);
        seg1.Update(1, 0, m, from, to, 0);
      }
      if (v == 0) {
        printf("%d\n", all[l]);
        goto END;
      }
      if (l == r) {
        printf("-1\n");
        goto END;
      }
      if (seg1.Query(1, 0, m, l, r - 1).minj > -v) {
        printf("-1\n");
        goto END;
      }
      le = l, ri = r - 1;
      while (le < ri) {
        int mid = le + ri >> 1;
        long long x = seg1.Query(1, 0, m, l, mid).minj;
        if (x > -v)
          le = mid + 1;
        else
          ri = mid;
      }
      pos = le;
      sum = seg1.Query(1, 0, m, l, pos - 1).sum;
      k = seg1.Query(1, 0, m, pos, pos).sum / (all[pos + 1] - all[pos]);
      printf("%.9lf\n", 1.0 * (-v - sum) / k + all[pos]);
    END:;
      if (~from) seg1.Update(1, 0, m, from, to, val);
    }
  }
  return 0;
}
