func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int read() {     int x = 0, f = 1;     char c = getchar();     for (; !isdigit(c); c = getchar())       if (c ==  - ) f = -1;     for (; isdigit(c); c = getchar()) x = x * 10 + c -  0 ;     return x * f;   }   const long long MAXN = 500010;   const long long Mod = 1000000007LL;   struct data {     long long x, y;     inline void ModT() { x %= Mod, y %= Mod; }   } a[MAXN + 1], pre[MAXN + 1];   inline data md(long long x, long long y) {     data xxx;     xxx.x = x, xxx.y = y;     return xxx;   }   inline long long operator*(const data &a, const data &b) {     return a.x * b.y - b.x * a.y;   }   inline data operator+(const data &a, const data &b) {     return md(a.x + b.x, a.y + b.y);   }   inline data operator-(const data &a, const data &b) {     return md(a.x - b.x, a.y - b.y);   }   long long N, tmp, Sum0[MAXN + 1], Sum1[MAXN + 1], ans;   int main() {     N = read();     for (long long i = 1; i <= N; i++) {       long long x = read(), y = read();       a[i] = md(x, y);       pre[i] = pre[i - 1] + a[i], pre[i].ModT();     }     for (int i = 2; i <= N; i++) {       tmp = a[i - 1] * a[i];       Sum0[i] = Sum0[i - 1] + tmp;       Sum1[i] = (Sum1[i - 1] + Sum0[i]) % Mod;     }     long long Now = abs(Sum0[N + 1] = Sum0[N] + a[N] * a[1]);     long long j = 1;     for (long long i = 3; i <= N; i++) {       for (; j < i - 1 && abs(Sum0[i] - Sum0[j] + a[i] * a[j]) > Now / 2.0; ++j)         ;       ans = (ans + Sum0[i] % Mod * (i - 1 - j) - (Sum1[i - 2] - Sum1[j - 1]) +              a[i] * (pre[i - 2] - pre[j - 1])) %             Mod;       ans = (ans + Sum1[j - 1] + pre[j - 1] * a[i] +              (Sum0[N + 1] - Sum0[i]) % Mod * (j - 1)) %             Mod;     }     ans = ((Now % Mod * (Mod + 1 >> 2) % Mod * N % Mod * (N - 3) % Mod + ans) %                Mod +            Mod) *           2LL % Mod;     printf( %lld n , ans);     return 0;   }   