#include using namespace std; using pll = pair; // modint template struct Fp { long long val; constexpr Fp(long long v = 0) noexcept : val(v % MOD) { if (val < 0) val += MOD; } constexpr int getmod() const { return MOD; } constexpr Fp operator - () const noexcept { return val ? MOD - val : 0; } constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; } constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; } constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; } constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; } constexpr Fp& operator += (const Fp& r) noexcept { val += r.val; if (val >= MOD) val -= MOD; return *this; } constexpr Fp& operator -= (const Fp& r) noexcept { val -= r.val; if (val < 0) val += MOD; return *this; } constexpr Fp& operator *= (const Fp& r) noexcept { val = val * r.val % MOD; return *this; } constexpr Fp& operator /= (const Fp& r) noexcept { long long a = r.val, b = MOD, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b, swap(a, b); u -= t * v, swap(u, v); } val = val * u % MOD; if (val < 0) val += MOD; return *this; } constexpr bool operator == (const Fp& r) const noexcept { return this->val == r.val; } constexpr bool operator != (const Fp& r) const noexcept { return this->val != r.val; } friend constexpr istream& operator >> (istream& is, Fp& x) noexcept { is >> x.val; x.val %= MOD; if (x.val < 0) x.val += MOD; return is; } friend constexpr ostream& operator << (ostream& os, const Fp& x) noexcept { return os << x.val; } friend constexpr Fp modpow(const Fp& r, long long n) noexcept { if (n == 0) return 1; if (n < 0) return modpow(modinv(r), -n); auto t = modpow(r, n / 2); t = t * t; if (n & 1) t = t * r; return t; } friend constexpr Fp modinv(const Fp& r) noexcept { long long a = r.val, b = MOD, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b, swap(a, b); u -= t * v, swap(u, v); } return Fp(u); } }; const int MOD = 1000000007; using mint = Fp; mint calc_area(vector vp) { int N = vp.size(); mint res = 0; for (int i = 0; i < N; ++i) { mint px = vp[i].first, py = vp[(i+1)%N].first; mint qx = vp[i].second, qy = vp[(i+1)%N].second; res += px * qy - py * qx; } return res; } long long GCD(long long x, long long y) { if (y == 0) return x; else return GCD(y, x % y); } int main() { int N; cin >> N; vector X(N), Y(N); for (int i = 0; i < N; ++i){ cin >> X[i] >> Y[i]; if(Y[i]<0){ X[i]*=-1; Y[i]*=-1; } } vector ids(N); iota(ids.begin(), ids.end(), 0); sort(ids.begin(), ids.end(), [&](int i, int j) { return Y[i]*X[j] < Y[j]*X[i]; }); vector vp; vp.emplace_back(0, 0); for (auto i : ids) { auto p = vp.back(); vp.emplace_back(p.first + X[i], p.second + Y[i]); } auto p = vp.back(); int M = vp.size(); for (int i = 1; i < M-1; ++i) { vp.emplace_back(p.first - vp[i].first, p.second - vp[i].second); } mint S = calc_area(vp); mint B = 0; for (int i = 0; i < vp.size(); ++i) { long long dx = vp[(i+1)%vp.size()].first - vp[i].first; long long dy = vp[(i+1)%vp.size()].second - vp[i].second; dx = abs(dx), dy = abs(dy); long long g = GCD(dx, dy); B += g; } mint res = (S + B) / 2; res = res+1; cout << res << endl; }