import itertools as iter import collections as coll import heapq as hq import bisect as bis from decimal import Decimal as dec from functools import cmp_to_key import math import sys #import pypyjit #pypyjit.set_param('max_unroll_recursion=-1') sys.setrecursionlimit(10 ** 6) inp = sys.stdin.readline input = lambda : inp().rstrip() getN = lambda : int(inp()) getNs = lambda : map(int, inp().split()) getList = lambda :list(map(int, inp().split())) getStrs = lambda n : [input() for _ in [0] * n] def yexit(): print("Yes"); exit(0) def nexit(): print("No"); exit(0) pi = 3.141592653589793 mod = 1000000007 MOD = 998244353 INF = 4611686018427387903 dx = [1, 0, -1, 0]; dy = [0, 1, 0, -1] class Vector2: def __init__(self, x: int, y: int): self.x = x self.y = y def __lt__(self, other): return area(self, other) > 0 def area(v1: Vector2, v2: Vector2) -> int: return v1.x * v2.y - v1.y * v2.x """ Main Code """ n = getN() vector = [] for x, y in [getList() for _ in [0] * n]: if(x == 0 and y == 0): continue if(y < 0): x = -x y = -y vector.append(Vector2(x, y)) vector.sort() S, bh = 0, 0 lx, ly = 0, 0 for v in vector: v1 = Vector2(lx, ly) v2 = Vector2(lx + v.x, ly + v.y) S += area(v1, v2) % mod S %= mod bh += math.gcd(v.x, v.y) bh %= mod lx, ly = v2.x, v2.y ans = (S + bh + 1) % mod print(ans)