#include using namespace std; using Int = long long; template struct DynamicConvexHullTrick { using number = double; struct Line { T m,b,val; number x; bool q; Line(T m=0,T b=0):m(m),b(b),val(0),x(-INF),q(false){} T eval(T x) const{return m*x+b;} bool parallel(const Line &l) const{return m==l.m;} number intersect(const Line &l) const{ return parallel(l)?number(INF):number(l.b-b)/number(m-l.m); } bool operator<(const Line &l) const{ if(l.q) return x hull; using iter = typename set::iterator; bool cPrev(iter it){return it!=hull.begin();} bool cNext(iter it){return it!=hull.end()&&next(it)!=hull.end();} bool bad(const Line &l1,const Line &l2,const Line &l3){ return l1.intersect(l3) <= l1.intersect(l2); } bool bad(iter it){ return cPrev(it)&&cNext(it)&&bad(*prev(it),*it,*next(it)); } iter update(iter it){ if(!cPrev(it)) return it; number x=it->intersect(*prev(it)); Line tmp(*it); tmp.x=x; it=hull.erase(it); return hull.insert(it,tmp); } void addLine(T m,T b){ if(isMin) m=-m,b=-b; Line l(m,b); iter it=hull.lower_bound(l); if(it!=hull.end()&&l.parallel(*it)){ if(it->beval(x)); return it->eval(x); } } ; //INSERT ABOVE HERE signed main(){ Int n; cin>>n; vector a(n),x(n),y(n); for(Int i=0;i>a[i]; for(Int i=0;i>x[i]; for(Int i=0;i>y[i]; const Int INF = 1e18; vector dp(n+1,INF); dp[0]=0; DynamicConvexHullTrick dc; for(Int i=0;i