#include using namespace std; #define int long long #define double long double #define ii pair #define app push_back #define all(a) a.begin(), a.end() #define bp __builtin_popcount #define ll long long const int N = 2007, C = 1e4 + 7, MOD = 1000 * 1000 * 1000 + 7; int mod(int n) { n %= MOD; if (n < 0) return n + MOD; else return n; } int fp(int a, int p) { int ans = 1, c = a; for (int i = 0; (1ll << i) <= p; ++i) { if ((p >> i) & 1) ans = mod(ans * c); c = mod(c * c); } return ans; } int dv(int a, int b) { return mod(a * fp(b, MOD - 2)); } int n, ans = 0; struct Point { int x, y; bool operator < (Point p) { return (y < p.y) || (y == p.y && x > p.x); } } a[N]; int cp(int x1, int y1, int x2, int y2) { return x1 * y2 - y1 * x2; } struct Line { int x, y, i, j; bool operator < (Line l) { int t = cp(x, y, l.x, l.y); return t > 0 || (t == 0 && i < l.i) || (t == 0 && i == l.i && j < l.j); } }; struct Fen { int f[N]; void clear() { for (int i = 0; i < N; ++i) f[i] = 0; } void add(int i, int x) { for (; i < N; i |= i + 1) f[i] += x; } int get(int i) { int ans = 0; for (; i >= 0; i &= i + 1, --i) ans += f[i]; return ans; } int get(int l, int r) { return get(r) - get(l - 1); } } fx, fy; int pos[N]; Point ord[N]; signed main() { #ifdef HOME freopen("input.txt", "r", stdin); #else ios_base::sync_with_stdio(0); cin.tie(0); #endif cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i].x >> a[i].y; a[i].x += C; a[i].y += C; } sort(a, a + n); for (int i = 0; i < n; ++i) ord[i] = a[i]; vector l; for (int i = 0; i < n; ++i) { for (int j = i + 1; j < n; ++j) { l.app({a[j].x - a[i].x, a[j].y - a[i].y, i, j}); } } for (int i = 0; i < n; ++i) pos[i] = i; sort(all(l)); int ptr = 0; for (int i = 0; i < n; ++i) { fx.add(i, a[i].x); fy.add(i, a[i].y); } while (ptr < l.size()) { int t = ptr; vector mem; while (ptr < l.size() && cp(l[t].x, l[t].y, l[ptr].x, l[ptr].y) == 0) { auto &e = l[ptr]; mem.app(e); swap(pos[e.i], pos[e.j]); fx.add(pos[e.i], ord[pos[e.j]].x-ord[pos[e.i]].x); fy.add(pos[e.i], ord[pos[e.j]].y-ord[pos[e.i]].y); fx.add(pos[e.j], ord[pos[e.i]].x-ord[pos[e.j]].x); fy.add(pos[e.j], ord[pos[e.i]].y-ord[pos[e.j]].y); swap(ord[pos[e.i]], ord[pos[e.j]]); ++ptr; } for (auto e : mem) { int j = e.i, k = e.j; int C = a[j].x * a[k].y - a[j].y * a[k].x; int A = (a[j].y - a[k].y); int B = (a[k].x - a[j].x); int l = -1, r = n; while (l < r - 1) { int m = (l + r) >> 1; if (C + ord[m].x * A + ord[m].y * B < 0) l = m; else r = m; } int lx = fx.get(l); int ly = fy.get(l); ans -= C * (l + 1); ans -= A * lx; ans -= B * ly; ans += C * (n - l - 1); ans += A * (fx.get(n) - lx); ans += B * (fy.get(n) - ly); ans = mod(ans); /* vector t; for (int i = 0; i < n; ++i) { t.app(C + ord[i].x * A + ord[i].y * B); ans += abs(C + ord[i].x * A + ord[i].y * B); } for (int i = 0; i + 1 < t.size(); ++i) assert(t[i] <= t[i+1]); */ } } cout << dv(ans, 3) << '\n'; }