#include #include #include #include #include #include #include #include #include #include #include #include #include #include #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; template vector> vec2d(int n, int m, T v){ return vector>(n, vector(m, v)); } template vector>> vec3d(int n, int m, int k, T v){ return vector>>(n, vector>(m, vector(k, v))); } template void print_vector(vector v, char delimiter=' '){ if(v.empty()) { cout << endl; return; } for(int i = 0; i+1 < v.size(); i++) cout << v[i] << delimiter; cout << v.back() << endl; } using mint = atcoder::modint1000000007; ostream& operator<<(ostream& os, const mint& m){ os << m.val(); return os; } template struct point{ T x, y; point(T x, T y): x(x), y(y) {} }; template ostream& operator<<(ostream& os, const point& p){ os << p.x << ' ' << p.y; return os; } /** * for sorting by atan2(x, y) * verified: https://judge.yosupo.jp/submission/91704 */ template bool comp(point p1, point p2){ if(p1.y >= 0 && p2.y < 0) return false; if(p1.y < 0 && p2.y >= 0) return true; if(p1.y == 0 && p2.y == 0) return p1.x > p2.x; if(p1.y == 0 && p1.x == 0) return p2.y > 0; if(p2.y == 0 && p2.x == 0) return p1.y < 0; return p1.y*p2.x < p1.x*p2.y; } using Po = point; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; int n; cin >> n; vector ps; for(int i = 0; i < n; i++){ int x, y; cin >> x >> y; ps.push_back(Po(x, y)); ps.push_back(Po(-x, -y)); } sort(ps.begin(), ps.end(), comp); ll x = 0, y = 0; mint b = 0; mint s = 0; for(auto p: ps){ ll xx = x+p.x; ll yy = y+p.y; ll g = gcd(abs(p.x), abs(p.y)); s += (mint(yy)*mint(x)-mint(xx)*mint(y))/2; b += g; x = xx; y = yy; } mint ans = s+b/2+1; cout << ans << endl; }