#include namespace { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #include #pragma GCC diagnostic pop using namespace std; using namespace atcoder; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) template bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; } template bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; } using ll = long long; using P = pair; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; using mint = modint1000000007; struct Vec { using etype = long long; // type of elements using ptype = __int128; // type of product results etype x = 0, y = 0; constexpr Vec operator-() const { return {-x, -y}; } friend constexpr Vec operator+(const Vec& a, const Vec& b) { return {a.x + b.x, a.y + b.y}; } friend constexpr Vec operator-(const Vec& a, const Vec& b) { return {a.x - b.x, a.y - b.y}; } friend mint operator*(const Vec& a, const Vec& b) { return mint(a.x) * b.y - mint(a.y) * b.x; } template >* = nullptr> friend constexpr Vec operator*(T c, const Vec& a) { return {c * a.x, c * a.y}; } template >* = nullptr> friend constexpr Vec operator*(const Vec& a, T c) { return c * a; } template >* = nullptr> friend constexpr Vec operator/(const Vec& a, T c) { return {a.x / c, a.y / c}; } Vec& operator+=(const Vec& a) { x += a.x; y += a.y; return *this; } Vec& operator-=(const Vec& a) { x -= a.x; y -= a.y; return *this; } template >* = nullptr> Vec& operator*=(T c) { x *= c; y *= c; return *this; } friend constexpr bool operator==(const Vec& a, const Vec& b) { return a.x == b.x && a.y == b.y; } friend constexpr bool operator!=(const Vec& a, const Vec& b) { return !(a == b); } constexpr int quadrant() const { return y > 0 ? (x > 0 ? 0 : 1) : y < 0 ? (x < 0 ? 2 : 3) : (x > 0 ? 0 : x < 0 ? 2 : -1); } friend constexpr bool operator<(const Vec& a, const Vec& b) { int qa = a.quadrant(), qb = b.quadrant(); if (qa != qb) return qa < qb; ptype p1 = (ptype)a.x * b.y, p2 = (ptype)a.y * b.x; return p1 > p2 || (p1 == p2 && (a.x != 0 ? abs(a.x) < abs(b.x) : abs(a.y) < abs(b.y))); } friend constexpr bool operator>(const Vec& a, const Vec& b) { return b < a; } friend constexpr bool operator<=(const Vec& a, const Vec& b) { return !(b < a); } friend constexpr bool operator>=(const Vec& a, const Vec& b) { return !(a < b); } constexpr bool parallel_to(const Vec& a) const { return (ptype)x * a.y == (ptype)y * a.x; } constexpr ptype dot(const Vec& a) const { return (ptype)x * a.x + (ptype)y * a.y; } constexpr ptype norm2() const { return (ptype)x * x + (ptype)y * y; } constexpr bool is_zero() const { return x == 0 && y == 0; } constexpr Vec normalize() const { if (x == 0) return Vec{0, (y == 0 ? 0 : 1)}; etype g = gcd(x, y); return *this / (x > 0 ? g : -g); } constexpr Vec rot90() const { return {-y, x}; } // exclusive constexpr bool in_between(const Vec& a, const Vec& b) const { Vec x = a - *this, y = b - *this; return x.parallel_to(y) && x.dot(y) < 0; } friend std::ostream& operator<< (std::ostream& os, const Vec& t) { return os << t.x << ' ' << t.y; } friend std::istream& operator>> (std::istream& os, Vec& t) { return os >> t.x >> t.y; } }; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector v; rep(i, n) { Vec vi; cin >> vi; if (vi == Vec{0, 0}) continue; v.emplace_back(vi); v.emplace_back(-vi); } sort(all(v)); mint ans = 2; Vec now = {0, 0}; for(Vec vi: v) { Vec nxt = now + vi; ans += now * nxt; Vec t = vi.normalize(); ll p = max(abs(t.x), abs(t.y)); ll q = max(abs(vi.x), abs(vi.y)); ans += q / p; now = nxt; } ans /= 2; cout << ans.val() << '\n'; }