#include<vector> #include<iostream> using namespace std; int main() { int n; cin >> n; vector<int> a(n), b(n); for (int i = 0;i < n;i++) cin >> a[i]; for (int i = 0;i < n;i++) cin >> b[i]; int sum1 = 0, sum2 = 0; for (int i = 0;i < n;i++) { sum1 += a[i] * i; sum2 += b[i] * i; } cout << sum2 - sum1 << endl; return 0; }