#include #define fst(t) std::get<0>(t) #define snd(t) std::get<1>(t) #define thd(t) std::get<2>(t) #define unless(p) if(!(p)) #define until(p) while(!(p)) using ll = std::int64_t; using P = std::tuple; int N; ll K[300100], L[300100], D[300100]; int main(){ std::cin.tie(nullptr); std::ios::sync_with_stdio(false); std::cin >> N; for(int i=0;i> K[i] >> L[i] >> D[i]; } ll lb = 0, ub = 1001001001001001001; while(ub - lb > 1){ ll m = (lb + ub) / 2, eo = 0; for(int i=0;i