#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a>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; auto tri=[](Int x){x=abs(x);return x*x*x;}; for(Int i=0;i(i,1500);j++){ Int k=i-j; chmin(dp[i+1],dp[k]+tri(x[k]-a[i])+tri(y[k])); //chmin(dp[i+1],dp[j]+tri(x[j]-a[i])+tri(y[j])); } } cout<