#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int ll; typedef pair P; int main() { int n; cin>>n; ll a[300001], x[300001], y[300001]; for(int i=1; i<=n; i++) cin>>a[i]; for(int i=1; i<=n; i++) cin>>x[i]; for(int i=1; i<=n; i++) cin>>y[i]; deque

line; ll dp=0; for(int i=1; i<=n; i++){ ll a0=-2*x[i], b0=x[i]*x[i]+y[i]*y[i]+dp; if(!(line.size()>=1 && line.back().first==a0 && line.back().second<=b0)){ while(line.size()>1){ ll a1=line[line.size()-1].first, b1=line[line.size()-1].second; ll a2=line[line.size()-2].first, b2=line[line.size()-2].second; if((b1-b2)*(a1-a0)<(b0-b1)*(a2-a1)) break; line.pop_back(); } line.push_back(P(a0, b0)); } while(line.size()>1){ ll a1=line[0].first, b1=line[0].second; ll a2=line[1].first, b2=line[1].second; if(a1*a[i]+b1