#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long mod7 = 1000000007LL;
inline long long getint() {
  long long _x = 0, _tmp = 1;
  char _tc = getchar();
  while ((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
  if (_tc == '-') _tc = getchar(), _tmp = -1;
  while (_tc >= '0' && _tc <= '9') _x *= 10, _x += (_tc - '0'), _tc = getchar();
  return _x * _tmp;
}
inline long long add(long long _x, long long _y, long long _mod = mod7) {
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline long long sub(long long _x, long long _y, long long _mod = mod7) {
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline long long mul(long long _x, long long _y, long long _mod = mod7) {
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
long long mypow(long long _a, long long _x, long long _mod) {
  if (_x == 0) return 1ll;
  long long _ret = mypow(mul(_a, _a, _mod), _x >> 1, _mod);
  if (_x & 1) _ret = mul(_ret, _a, _mod);
  return _ret;
}
long long mymul(long long _a, long long _x, long long _mod) {
  if (_x == 0) return 0ll;
  long long _ret = mymul(add(_a, _a, _mod), _x >> 1, _mod);
  if (_x & 1) _ret = add(_ret, _a, _mod);
  return _ret;
}
void sleep(double sec = 1021) {
  clock_t s = clock();
  while (clock() - s < CLOCKS_PER_SEC * sec)
    ;
}
int __ = 1, _cs;
const int mxN = 1e5 + 5, bs = 200, bc = (mxN - 1) / bs + 1;
int nq, n;
array<int, 4> q[mxN];
vector<int> v;
long long s[mxN], ms[bc], ts[bc], lz2[bc];
bool lz1[bc];
void pb(int i) {
  if (lz1[i]) {
    for (int l = i * bs; l < min(n - 1, (i + 1) * bs); ++l) s[l] = lz2[i];
    lz1[i] = 0;
  }
}
void ub(int i) {
  ts[i] = ms[i] = 0;
  for (int l = i * bs; l < min(n - 1, (i + 1) * bs); ++l) {
    ts[i] += s[l] * (v[l + 1] - v[l]);
    ms[i] = min(ts[i], ms[i]);
  }
}
void upd(int l, int r, long long x) {
  int bi = l / bs;
  pb(bi);
  for (; l < (bi + 1) * bs && l <= r; ++l) s[l] = x;
  ub(bi++);
  if (l > r) return;
  for (; l + bs <= r; l += bs, ++bi) {
    lz1[bi] = 1;
    lz2[bi] = x;
    ts[bi] = (v[l + bs] - v[l]) * x;
    if (x > 0)
      ms[bi] = 0;
    else
      ms[bi] = ts[bi];
  }
  pb(bi);
  for (; l <= r; ++l) {
    s[l] = x;
  }
  ub(bi);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  v.push_back(0);
  v.push_back(1e9 + 1);
  cin >> nq;
  for (int i = 0; i < nq; ++i) {
    cin >> q[i][0] >> q[i][1];
    if (q[i][0] != 2) cin >> q[i][2];
    if (q[i][0] == 3) cin >> q[i][3];
    if (q[i][0] == 1) v.push_back(q[i][1]);
  }
  sort(v.begin(), v.end());
  v.resize(unique(v.begin(), v.end()) - v.begin());
  n = v.size();
  for (int i = 0; i < nq; ++i) {
    if (q[i][0] != 3)
      q[i][1] = lower_bound(v.begin(), v.end(), q[i][1]) - v.begin();
  }
  cout << fixed << setprecision(9);
  map<int, int> m{{0, 0}, {n - 1, 0}};
  for (int qi = 0; qi < nq; ++qi) {
    if (q[qi][0] == 1) {
      auto it = m.lower_bound(q[qi][1]);
      upd(q[qi][1], it->first - 1, q[qi][2]);
      m[q[qi][1]] = q[qi][2];
    } else if (q[qi][0] == 2) {
      m.erase(q[qi][1]);
      auto it1 = m.lower_bound(q[qi][1]), it2 = it1--;
      upd(it1->first, it2->first - 1, it1->second);
    } else {
      int li = lower_bound(v.begin(), v.end(), q[qi][1]) - v.begin(),
          ri = lower_bound(v.begin(), v.end(), q[qi][2]) - v.begin() - 1;
      li = m.lower_bound(li)->first;
      int bi = li / bs;
      long long c = q[qi][3];
      if (c <= 0) {
        cout << q[qi][1] << "\n";
        continue;
      }
      if (li > ri) {
        cout << "-1\n";
        continue;
      }
      bool sc = 0;
      pb(bi);
      for (; li < (bi + 1) * bs && li <= ri && !sc; ++li) {
        int df = min(q[qi][2], v[li + 1]) - v[li];
        if (c + df * s[li] <= 0) {
          cout << (long double)-c / s[li] + v[li] << "\n";
          sc = 1;
        }
        c += df * s[li];
      }
      if (sc) continue;
      ++bi;
      for (; li + bs <= ri; li += bs, ++bi) {
        if (c + ms[bi] <= 0) break;
        c += ts[bi];
      }
      pb(bi);
      for (; li <= ri && !sc; ++li) {
        int df = min(q[qi][2], v[li + 1]) - v[li];
        if (c + df * s[li] <= 0) {
          cout << (long double)-c / s[li] + v[li] << "\n";
          sc = 1;
        }
        c += df * s[li];
      }
      if (sc) continue;
      cout << "-1\n";
    }
  }
}
