import sys from math import gcd input = sys.stdin.readline MOD = 10 ** 9 + 7 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 n = int(input()) vectors = [] for _ in [0] * n: x, y = map(int, input().split()) if(x == 0 and y == 0): continue if(y < 0): x, y = -x, -y vectors.append(Vector2(x, y)) vectors.sort() s, bh = 0, 0 lx, ly = 0, 0 for v in vectors: v1 = Vector2(lx, ly) v2 = Vector2(lx + v.x, ly + v.y) s += area(v1, v2) % MOD s %= MOD bh += gcd(v.x, v.y) bh %= MOD lx, ly = v2.x, v2.y ans = (s + bh + 1) % MOD print(ans)