#include <bits/stdc++.h>
using namespace std;
int q;
struct item {
  int key, prior;
  long long tot;
  long long rate;
  long long low;
  long long sum;
  item *l, *r;
  item() {}
  item(int key, int prior)
      : key(key),
        prior(prior),
        tot(0),
        rate(0),
        low(0),
        sum(0),
        l(NULL),
        r(NULL) {}
};
typedef item* pitem;
long long sum(pitem t) { return t ? t->sum : 0ll; }
long long low(pitem t) { return t ? t->low : (long long)1e9; }
void upd_cnt(pitem t) {
  if (t) {
    t->sum = t->tot + sum(t->l) + sum(t->r);
    t->low = min(low(t->l), sum(t->l) + t->tot);
    t->low = min(t->low, sum(t->l) + t->tot + low(t->r));
  }
}
void split(pitem t, int key, pitem& l, pitem& r) {
  if (!t)
    l = r = NULL;
  else if (key <= t->key)
    split(t->l, key, l, t->l), r = t;
  else
    split(t->r, key, t->r, r), l = t;
  upd_cnt(t);
}
void merge(pitem& t, pitem l, pitem r) {
  if (!l || !r)
    t = l ? l : r;
  else if (l->prior > r->prior)
    merge(l->r, l->r, r), t = l;
  else
    merge(r->l, l, r->l), t = r;
  upd_cnt(t);
}
pitem root;
pitem find_small(pitem v) {
  if (!v) {
    return NULL;
  }
  if (v->l != NULL) {
    return find_small(v->l);
  }
  return v;
}
pitem find_large(pitem v, long long t) {
  if (!v) {
    return NULL;
  }
  if (v->r != NULL) {
    pitem res = find_large(v->r, t);
    upd_cnt(v);
    return res;
  }
  v->tot = 1ll * (t - v->key) * v->rate;
  upd_cnt(v);
  return v;
}
pitem find_large(pitem v) {
  if (!v) {
    return NULL;
  }
  if (v->r != NULL) {
    pitem res = find_large(v->r);
    return res;
  }
  return v;
}
void output(pitem t) {
  if (!t) return;
  output(t->l);
  printf("key=%d tot=%lld", t->key, t->tot);
  output(t->r);
}
int main() {
  cin >> q;
  for (int i = 0; i < q; i++) {
    int ope;
    scanf("%d", &ope);
    if (ope == 1) {
      int s, t;
      scanf("%d %d", &t, &s);
      pitem l, r;
      split(root, t, l, r);
      pitem v = new item(t, rand());
      v->rate = s;
      if (r == NULL) {
        v->tot = 1ll * ((long long)2e9) * s;
      } else {
        v->tot = 1ll * (find_small(r)->key - t) * s;
      }
      v->low = v->tot;
      v->sum = v->tot;
      if (l != NULL) {
        find_large(l, t);
      }
      merge(root, l, v);
      merge(root, root, r);
    } else if (ope == 2) {
      int t;
      scanf("%d", &t);
      pitem l, mid, r;
      split(root, t, l, mid);
      split(mid, t + 1, mid, r);
      if (r == NULL) {
        find_large(l, (long long)2e9);
      } else {
        find_large(l, find_small(r)->key);
      }
      merge(root, l, r);
    } else {
      int l, r, v;
      scanf("%d %d %d", &l, &r, &v);
      if (v == 0) {
        printf("%d\n", l);
        continue;
      }
      pitem L, mid, R;
      split(root, l, L, mid);
      split(mid, r, mid, R);
      if (mid != NULL) {
        int lb = l - 1, ub = r;
        while (ub - lb > 1) {
          int Mid = (ub + lb) >> 1;
          pitem temp;
          split(mid, Mid + 1, temp, mid);
          bool good;
          if (1ll * v + low(temp) > 0) {
            good = false;
          } else {
            good = true;
          }
          merge(mid, temp, mid);
          if (good)
            ub = Mid;
          else
            lb = Mid;
        }
        if (ub == r) {
          puts("-1");
        } else {
          double res = 0.;
          double cur = v;
          pitem temp;
          split(mid, ub + 1, temp, mid);
          pitem highest = find_large(temp);
          pitem LEFT;
          split(temp, highest->key, LEFT, temp);
          cur += sum(LEFT);
          if (1ll * v + (sum(LEFT) + 1ll * (r - temp->key) * temp->rate) > 0) {
            puts("-1");
          } else {
            res = 1. * temp->key + -1. * cur / temp->rate;
            printf("%.10lf\n", res);
          }
          merge(temp, LEFT, temp);
          merge(mid, temp, mid);
        }
      } else {
        puts("-1");
      }
      merge(root, L, mid);
      merge(root, root, R);
    }
  }
}
