#include <bits/stdc++.h>
using namespace std;
enum Type { Modify, Solve };
struct Query {
  Type type;
  long long newChange;
  long long timeStart;
  long long timeFinish;
  long long initValue;
};
const int Q = 1e5 + 2;
const long long NO_CHANGE = -(1e6 + 1e9);
const long long FIRST_TIME = 0;
const long long LAST_TIME = 1e9 + 1;
int q;
Query queries[Q];
int timePoints;
long long idxToTime[Q];
map<long long, int> timeToIdx;
struct Node {
  int leftIdx;
  int rightIdx;
  int middleIdx;
  long long leftTime;
  long long rightTime;
  long long middleTime;
  Node* leftChild;
  Node* rightChild;
  long long fullTime;
  long long lastChange;
  long long noChangeTime;
  long long localFullChange;
  long long localMinFall;
  Node(int leftIdxToSet, int rightIdxToSet) {
    leftIdx = leftIdxToSet;
    rightIdx = rightIdxToSet;
    leftTime = idxToTime[leftIdx];
    rightTime = idxToTime[rightIdx];
    fullTime = rightTime - leftTime;
    if (leftIdx + 1 == rightIdx) {
      middleIdx = -123456789;
      middleTime = -123456789;
      leftChild = nullptr;
      rightChild = nullptr;
    } else {
      middleIdx = (leftIdx + rightIdx) / 2;
      middleTime = idxToTime[middleIdx];
      leftChild = new Node(leftIdx, middleIdx);
      rightChild = new Node(middleIdx, rightIdx);
    }
    recalc();
  }
  void modify(long long startTime, long long newChange) {
    if (!leftChild) {
      recalc(newChange);
      return;
    }
    if (startTime < middleTime) {
      leftChild->modify(startTime, newChange);
    } else {
      rightChild->modify(startTime, newChange);
    }
    recalc();
  }
  bool findFall(long long startTime, long long finishTime,
                long long& currentValue, long long& currentChange,
                long double& fallPoint) {
    if (!leftChild) {
      if (startTime == leftTime && lastChange != NO_CHANGE) {
        currentChange = lastChange;
      }
      if (currentValue <= 0) {
        fallPoint = startTime;
        return true;
      }
      long long resultValue =
          currentValue + (finishTime - startTime) * currentChange;
      if (resultValue > 0) {
        currentValue = resultValue;
        return false;
      }
      fallPoint = startTime + (long double)currentValue / (-currentChange);
      return true;
    }
    if (finishTime <= middleTime) {
      return leftChild->findFall(startTime, finishTime, currentValue,
                                 currentChange, fallPoint);
    }
    if (startTime >= middleTime) {
      return rightChild->findFall(startTime, finishTime, currentValue,
                                  currentChange, fallPoint);
    }
    if (startTime == leftTime) {
      if (currentValue + leftChild->getRealMinFall(currentChange) <= 0) {
        leftChild->findFall(startTime, middleTime, currentValue, currentChange,
                            fallPoint);
        return true;
      }
      currentValue += leftChild->getRealFullChange(currentChange);
      if (leftChild->lastChange != NO_CHANGE) {
        currentChange = leftChild->lastChange;
      }
    } else {
      if (leftChild->findFall(startTime, middleTime, currentValue,
                              currentChange, fallPoint)) {
        return true;
      }
    }
    if (finishTime == rightTime) {
      if (currentValue + rightChild->getRealMinFall(currentChange) <= 0) {
        rightChild->findFall(middleTime, finishTime, currentValue,
                             currentChange, fallPoint);
        return true;
      }
      currentValue += rightChild->getRealFullChange(currentChange);
      if (rightChild->lastChange != NO_CHANGE) {
        currentChange = rightChild->lastChange;
      }
    } else {
      if (rightChild->findFall(middleTime, finishTime, currentValue,
                               currentChange, fallPoint)) {
        return true;
      }
    }
    return false;
  }
  void recalc(long long newChange = NO_CHANGE) {
    if (!leftChild) {
      if (newChange == NO_CHANGE) {
        lastChange = NO_CHANGE;
        noChangeTime = fullTime;
        localFullChange = 0;
        localMinFall = 0;
      } else {
        lastChange = newChange;
        noChangeTime = 0;
        localFullChange = newChange * fullTime;
        localMinFall = min(0ll, localFullChange);
      }
    } else {
      lastChange = rightChild->lastChange;
      if (lastChange == NO_CHANGE) {
        lastChange = leftChild->lastChange;
      }
      noChangeTime = leftChild->noChangeTime;
      if (noChangeTime == leftChild->fullTime) {
        noChangeTime += rightChild->noChangeTime;
      }
      localFullChange = leftChild->localFullChange +
                        rightChild->getRealFullChange(leftChild->lastChange);
      localMinFall = min(leftChild->localMinFall,
                         leftChild->localFullChange +
                             rightChild->getRealMinFall(leftChild->lastChange));
    }
  }
  long long getRealFullChange(long long firstChange) {
    if (firstChange == NO_CHANGE) {
      firstChange = 0;
    }
    return firstChange * noChangeTime + localFullChange;
  }
  long long getRealMinFall(long long firstChange) {
    if (firstChange == NO_CHANGE) {
      firstChange = 0;
    }
    return min(0ll, firstChange * noChangeTime + localMinFall);
  }
};
Node* root;
void read() {
  cin >> q;
  for (int i = 0; i < q; ++i) {
    int type;
    cin >> type;
    if (type <= 2) {
      queries[i].type = Type::Modify;
      cin >> queries[i].timeStart;
      if (type == 1) {
        cin >> queries[i].newChange;
      } else {
        queries[i].newChange = NO_CHANGE;
      }
    } else {
      queries[i].type = Type::Solve;
      cin >> queries[i].timeStart >> queries[i].timeFinish >>
          queries[i].initValue;
    }
  }
}
void setTimePoints() {
  for (int i = 0; i < q; ++i) {
    if (queries[i].type == Type::Solve) {
      continue;
    }
    timeToIdx[queries[i].timeStart] = 0;
  }
  timeToIdx[FIRST_TIME] = 0;
  timeToIdx[LAST_TIME] = 0;
  timePoints = 0;
  for (auto& p : timeToIdx) {
    p.second = timePoints++;
    idxToTime[p.second] = p.first;
  }
}
void answer() {
  for (int i = 0; i < q; ++i) {
    if (queries[i].type == Type::Modify) {
      root->modify(queries[i].timeStart, queries[i].newChange);
    } else {
      long double res;
      long long initValue = queries[i].initValue;
      long long initChange = 0;
      if (!root->findFall(queries[i].timeStart, queries[i].timeFinish,
                          initValue, initChange, res)) {
        res = -1;
      }
      cout << res << '\n';
    }
  }
}
void solve() {
  read();
  setTimePoints();
  root = new Node(0, timePoints - 1);
  answer();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(20);
  solve();
  return 0;
}
