#include <bits/stdc++.h>
using namespace std;
mt19937 rng(static_cast<unsigned int>(
    chrono::steady_clock::now().time_since_epoch().count()));
template <typename num_t>
inline void add_mod(num_t& a, const int& b, const int& m) {
  a = (a + b);
  if (a >= m) a -= m;
}
template <typename num_t>
inline bool update_max(num_t& a, const num_t& b) {
  return a < b ? a = b, true : false;
}
template <typename num_t>
inline bool update_min(num_t& a, const num_t& b) {
  return a > b ? a = b, true : false;
}
template <typename num_t>
num_t gcd(num_t lhs, num_t rhs) {
  return !lhs ? rhs : gcd(rhs % lhs, lhs);
}
template <typename num_t>
num_t pw(num_t n, num_t k, const num_t& mod) {
  if (k == -1) k = mod - 2;
  num_t res = 1;
  for (; k > 0; k >>= 1) {
    if (k & 1) res = 1ll * res * n % mod;
    n = 1ll * n * n % mod;
  }
  return res % mod;
}
const int inf = 1e9 + 7;
const int mod = 998244353;
const long long ll_inf = 9ll * inf * inf + 7;
const int MAX_N = 100000 + 7;
namespace Treap {
template <typename num_t>
struct Node {
  Node *left, *right;
  int priority;
  int size, rev;
  num_t key, lz;
  num_t minimum_value;
  num_t original_speed, speed;
  num_t change;
  struct Time {
    num_t left, right;
  };
  Time time_points;
  Node(num_t key, num_t s, Node* l = nullptr, Node* r = nullptr, int h = rng())
      : key(key), left(l), right(r), original_speed(s) {
    priority = h;
    size = (l != nullptr ? l->size : 0) + 1 + (r != nullptr ? r->size : 0);
    rev = lz = 0;
    minimum_value = 0;
    time_points = {key, key};
    change = 0;
    speed = original_speed;
  }
};
template <typename num_t>
void get_burst(num_t& value, num_t speed, num_t first, num_t last,
               long double& ans) {
  if (value == 0) {
    ans = first;
    return;
  }
  if (value + speed * (last - first) <= 0) {
    ans = ((long double)value / (-1.0 * speed)) + first;
    return;
  } else {
    value += speed * (last - first);
    return;
  }
}
template <typename num_t>
void get_burst_time(Node<num_t>* root, num_t& initial_value, num_t end_time,
                    long double& ans) {
  if (root == nullptr) return;
  if (initial_value + root->minimum_value > 0) {
    initial_value += root->change;
    return get_burst(initial_value, root->speed, root->time_points.right,
                     end_time, ans);
  }
  get_burst_time(root->left, initial_value, root->key, ans);
  if (ans >= 0) return;
  num_t nxt = end_time;
  if (root->right != nullptr) nxt = root->right->time_points.left;
  get_burst(initial_value, root->original_speed, root->key, nxt, ans);
  if (ans >= 0) return;
  get_burst_time(root->right, initial_value, end_time, ans);
}
template <typename num_t>
inline int size(Node<num_t>* x) {
  return x ? x->size : 0;
}
template <typename num_t>
inline void pull(Node<num_t>* x) {
  x->size = size(x->left) + 1 + size(x->right);
  x->time_points = {x->key, x->key};
  if (x->left != nullptr) x->time_points.left = x->left->time_points.left;
  if (x->right != nullptr) x->time_points.right = x->right->time_points.right;
  x->change = 0;
  x->minimum_value = 0;
  if (x->left != nullptr) {
    x->change = x->left->change +
                (x->key - x->left->time_points.right) * x->left->speed;
    x->minimum_value = min(x->left->minimum_value, x->change);
  }
  if (x->right != nullptr) {
    x->change += (x->right->time_points.left - x->key) * x->original_speed;
    x->minimum_value = min(x->minimum_value, x->change);
    x->minimum_value =
        min(x->minimum_value, x->change + x->right->minimum_value);
    x->change += x->right->change;
  }
  x->speed = x->original_speed;
  if (x->right != nullptr) x->speed = x->right->speed;
}
template <typename num_t>
inline void reverse(Node<num_t>* x) {
  if (x == nullptr) return;
  swap(x->left, x->right);
  x->rev ^= 1;
}
template <typename num_t>
inline void push_down(Node<num_t>* x, const num_t& value) {
  if (x == nullptr) return;
  x->key += value;
  x->lz += value;
}
template <typename num_t>
void push(Node<num_t>* x) {
  if (x->rev) {
    reverse(x->left);
    reverse(x->right);
    x->rev = 0;
  }
  if (x->lz) {
    push_down(x->left, x->lz);
    push_down(x->right, x->lz);
    x->lz = 0;
  }
}
template <typename num_t>
Node<num_t>* join(Node<num_t>* x, Node<num_t>* y) {
  if (x == nullptr) return y;
  if (y == nullptr) return x;
  if (x->priority < y->priority) {
    push(x);
    x->right = join(x->right, y);
    pull(x);
    return x;
  } else {
    push(y);
    y->left = join(x, y->left);
    pull(y);
    return y;
  }
}
template <typename num_t>
void split(Node<num_t>* x, Node<num_t>*& l, Node<num_t>*& r, int pos) {
  if (!x) {
    l = r = nullptr;
    return;
  }
  push(x);
  if (size(x->left) + 1 <= pos) {
    split(x->right, x->right, r, pos - size(x->left) - 1);
    pull(l = x);
  } else {
    split(x->left, l, x->left, pos);
    pull(r = x);
  }
}
template <typename num_t>
void split(Node<num_t>* root, Node<num_t>*& left, Node<num_t>*& mid,
           Node<num_t>*& right, int l, int r) {
  split(root, left, mid, l);
  split(mid, mid, right, r - l + 1);
}
template <typename num_t>
void reverse(Node<num_t>*& root, int l, int r) {
  Node<num_t>*left, *mid, *right;
  split(root, left, mid, right, l, r);
  reverse(mid);
  root = join(left, join(mid, right));
}
template <typename num_t>
void update(Node<num_t>*& root, int l, int r, const num_t& val) {
  Node<num_t>*left, *mid, *right;
  split(root, left, mid, right, l, r);
  push_down(mid, val);
  root = join(left, join(mid, right));
}
template <typename num_t>
void split(Node<num_t>* x, Node<num_t>*& l, Node<num_t>*& r,
           const function<bool(Node<num_t>*)>& go_right) {
  if (!x) {
    l = r = nullptr;
    return;
  }
  push(x);
  if (go_right(x)) {
    split(x->right, x->right, r, go_right);
    pull(l = x);
  } else {
    split(x->left, l, x->left, go_right);
    pull(r = x);
  }
}
template <typename num_t>
void query(Node<num_t>* root, num_t left_time, num_t right_time,
           num_t& initial_value) {
  long double temp = -1;
  if (initial_value) {
    Node<num_t>*left, *mid, *right;
    split<num_t>(root, left, mid,
                 [&](Node<num_t>* x) { return x->key < left_time; });
    split<num_t>(mid, mid, right,
                 [&](Node<num_t>* x) { return x->key <= right_time; });
    get_burst_time(mid, initial_value, right_time, temp);
    root = join(left, join(mid, right));
  } else {
    temp = left_time;
  }
  if (temp < 0)
    cout << -1 << '\n';
  else
    cout << temp << '\n';
}
template <typename num_t>
void insert(Node<num_t>*& x, num_t key, num_t speed) {
  Node<num_t>* y;
  split<num_t>(x, x, y, [&](Node<num_t>* x) { return x->key < key; });
  x = join(x, join(new Node<num_t>(key, speed), y));
}
template <typename num_t>
Node<num_t>* erase(Node<num_t>*& x, num_t key) {
  Node<num_t>*l, *r, *res;
  split<num_t>(x, l, res, [&](Node<num_t>* x) { return x->key < key; });
  split<num_t>(res, res, r, [&](Node<num_t>* x) { return x->key <= key; });
  x = join(l, r);
  return res;
}
template <typename num_t>
void free(Node<num_t>* x) {
  if (!x) return;
  free(x->left);
  free(x->right);
  delete x;
}
template <typename num_t>
int depth(Node<num_t>* x) {
  if (!x) return 0;
  push(x);
  return 1 + max(depth(x->left), depth(x->right));
}
template <typename num_t>
void trace(Node<num_t>* x, int isrt = 1) {
  if (!x) return;
  push(x);
  trace(x->left, 0);
  cerr << "(" << x->key << "," << x->change << ") ";
  trace(x->right, 0);
  if (isrt) {
    cerr << "\n";
  }
}
};  // namespace Treap
using namespace Treap;
void solve() {
  Node<long long>* root = nullptr;
  int q;
  cin >> q;
  cout << fixed << setprecision(8);
  while (q-- > 0) {
    int op;
    cin >> op;
    long long u, v;
    if (op == 1) {
      cin >> u >> v;
      insert(root, u, v);
    } else if (op == 2) {
      cin >> u;
      erase(root, u);
    } else {
      long long in_v;
      cin >> u >> v >> in_v;
      query(root, u, v, in_v);
    }
  }
  free(root);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  const bool multiple_test = false;
  int test = 1;
  if (multiple_test) cin >> test;
  for (int i = 0; i < test; ++i) {
    solve();
  }
}
