#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
auto& errStream = cerr;
class CerrDummy {
} cerrDummy;
template <class T>
CerrDummy& operator<<(CerrDummy& cd, const T&) {
  return cd;
}
using charTDummy = char;
using traitsDummy = char_traits<charTDummy>;
CerrDummy& operator<<(CerrDummy& cd,
                      basic_ostream<charTDummy, traitsDummy>&(
                          basic_ostream<charTDummy, traitsDummy>&)) {
  return cd;
}
using pi = pair<ll, ll>;
using vi = vector<ll>;
using ld = long double;
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "{";
  for (ll i = ll(0); i < ll((ll)v.size()); i++) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}
template <ll i, class T>
void print_tuple(ostream&, const T&) {}
template <ll i, class T, class H, class... Args>
void print_tuple(ostream& os, const T& t) {
  if (i) os << ",";
  os << get<i>(t);
  print_tuple<i + 1, T, Args...>(os, t);
}
template <class... Args>
ostream& operator<<(ostream& os, const tuple<Args...>& t) {
  os << "(";
  print_tuple<0, tuple<Args...>, Args...>(os, t);
  return os << ")";
}
ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}
void printSpace() { printf(" "); }
void printEoln() { printf("\n"); }
void print(ll x, ll suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}
template <class T>
void print(const vector<T>& v) {
  for (ll i = ll(0); i < ll(v.size()); i++)
    print(v[i], i == ll(v.size()) - 1 ? 1 : 2);
}
string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}
char* readCharArray() {
  static char buf[3341000];
  static ll bufUsed = 0;
  char* ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}
template <class T, class U>
void chmax(T& a, U b) {
  if (a < b) a = b;
}
template <class T, class U>
void chmin(T& a, U b) {
  if (b < a) a = b;
}
template <class T>
T Sq(const T& t) {
  return t * t;
}
void Yes(bool ex = true) {
  cout << "YES" << endl;
  if (ex) exit(0);
}
void No(bool ex = true) {
  cout << "NO" << endl;
  if (ex) exit(0);
}
const ll infLL = LLONG_MAX / 3;
const ll inf = infLL;
constexpr ll TEN(ll n) { return n == 0 ? 1 : TEN(n - 1) * 10; }
template <class T>
vector<T> Uniqued(const vector<T>& vv) {
  auto v(vv);
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  return v;
}
template <class T>
void MakeUniqued(vector<T>& v) {
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
}
const ll unused = -inf;
struct Node {
  ll mn, sum;
};
Node LazyNode(ll lz, ll len) {
  Node res;
  if (lz >= 0)
    res.mn = 0;
  else
    res.mn = lz * len;
  res.sum = lz * len;
  return res;
};
Node Merge(const Node& x, const Node& y) {
  return Node{min(x.mn, x.sum + y.mn), x.sum + y.sum};
}
struct SegTree {
  ll s;
  vi pos, len;
  vi lz;
  vector<Node> ns;
  SegTree(vi pp) {
    pos = pp;
    ll n = pos.size();
    s = 1;
    while (s < n) s *= 2;
    pos.resize(s + 1, pos.back());
    ns.resize(s * 2, Node{0, 0});
    lz.resize(s * 2, unused);
    len.resize(s * 2);
    InitLen(0, s, 1);
  }
  void InitLen(ll l, ll r, ll i) {
    if (i < s) {
      InitLen(l, (l + r) / 2, i * 2);
      InitLen((l + r) / 2, r, i * 2 + 1);
    }
    len[i] = pos[r] - pos[l];
  }
  Node GetNode(ll i) {
    return lz[i] == unused ? ns[i] : LazyNode(lz[i], len[i]);
  }
  void Propagate(ll i) {
    if (lz[i] == unused) return;
    lz[i * 2] = lz[i * 2 + 1] = lz[i];
    ns[i] = LazyNode(lz[i], len[i]);
    lz[i] = unused;
  }
  void Update(ll i) {
    assert(lz[i] == unused);
    ns[i] = Merge(GetNode(i * 2), GetNode(i * 2 + 1));
  }
  void Set(ll b, ll e, ll v, ll l, ll r, ll i) {
    if (e <= l || r <= b) return;
    if (b <= l && r <= e) {
      cerrDummy << i << " " << l << " " << r << " " << v << endl;
      lz[i] = v;
      return;
    }
    Propagate(i);
    Set(b, e, v, l, (l + r) / 2, i * 2);
    Set(b, e, v, (l + r) / 2, r, i * 2 + 1);
    Update(i);
  }
  void Set(ll b, ll e, ll v) {
    cerrDummy << b << " " << e << " " << v << endl;
    Set(b, e, v, 0, s, 1);
  }
  bool Calc(ll b, ll e, ll& v, double& ans, ll l, ll r, ll i) {
    if (e <= l || r <= b) return false;
    if (b <= l && r <= e) {
      Node x = GetNode(i);
      cerrDummy << i << " " << l << " " << r << " " << x.mn << " " << x.sum
                << " " << len[i] << " " << lz[i] << endl;
      if (v + x.mn <= 0) {
        if (i >= s) {
          assert(lz[i] < 0);
          ans = pos[l] + double(v) / (-lz[i]);
        } else {
          Propagate(i);
          if (Calc(b, e, v, ans, l, (l + r) / 2, i * 2)) return true;
          bool w = Calc(b, e, v, ans, (l + r) / 2, r, i * 2 + 1);
          assert(w);
        }
        return true;
      } else {
        v += x.sum;
        return false;
      }
    }
    Propagate(i);
    if (Calc(b, e, v, ans, l, (l + r) / 2, i * 2)) return true;
    if (Calc(b, e, v, ans, (l + r) / 2, r, i * 2 + 1)) return true;
    return false;
  }
  double Calc(ll b, ll e, ll v) {
    cerrDummy << b << " " << e << " " << v << endl;
    double ans = -1;
    Calc(b, e, v, ans, 0, s, 1);
    return ans;
  }
};
struct Query {
  ll t, a, b, c;
};
signed main() {
  ll n = read();
  vector<Query> qs(n);
  const ll Vmin = -1, Vmax = TEN(9) + 1;
  vi pos{Vmin, Vmax};
  for (ll i = ll(0); i < ll(n); i++) {
    ll t = read();
    qs[i].t = t;
    if (t == 1) {
      qs[i].a = read();
      qs[i].b = read();
      pos.push_back(qs[i].a);
    } else if (t == 2) {
      qs[i].a = read();
      pos.push_back(qs[i].a);
    } else if (t == 3) {
      qs[i].a = read();
      qs[i].b = read();
      qs[i].c = read();
      pos.push_back(qs[i].b);
    }
  }
  MakeUniqued(pos);
  const auto idx = [&](ll x) {
    return lower_bound(pos.begin(), pos.end(), x) - pos.begin();
  };
  cerrDummy << pos << endl;
  SegTree seg(pos);
  set<pi> waf;
  waf.insert(pi(idx(Vmin), 0));
  waf.insert(pi(idx(Vmax), 0));
  set<ll> evs;
  for (ll i = ll(0); i < ll(n); i++) {
    if (qs[i].t == 1) {
      ll p = idx(qs[i].a), q = qs[i].b;
      auto itr = waf.insert(pi(p, q)).first;
      seg.Set(p, next(itr)->first, q);
      evs.insert(qs[i].a);
    } else if (qs[i].t == 2) {
      ll p = idx(qs[i].a);
      auto itr = waf.lower_bound(pi(p, -inf));
      itr = waf.erase(itr);
      seg.Set(p, itr->first, prev(itr)->second);
      evs.erase(qs[i].a);
    } else {
      cerrDummy << qs[i].a << " " << qs[i].b << " " << qs[i].c << endl;
      double ans = -1;
      if (qs[i].c == 0) {
        ans = qs[i].a;
      } else {
        auto itr = evs.lower_bound(qs[i].a);
        if (itr != evs.end() && *itr < qs[i].b) {
          ll p = idx(*itr), q = idx(qs[i].b);
          ans = seg.Calc(p, q, qs[i].c);
        }
      }
      if (ans < 0) {
        print(-1);
      } else {
        printf("%.10f\n", ans);
      }
    }
  }
}
