from functools import cmp_to_key from math import gcd import sys input = sys.stdin.readline mod = 10 ** 9 + 7 def area(v1, v2): x1, y1 = v1 x2, y2 = v2 return abs(x1 * y2 - x2 * y1) % mod def arg_sort(v1, v2): x1, y1 = v1 x2, y2 = v2 if(x1 * y2 == x2 * y1): return 0 elif(x1 * y2 - x2 * y1 < 0): return 1 else: return -1 n = int(input()) v = [] for _ in [0] * n: x, y = map(int, input().split()) if(y < 0): x = -x; y = -y v.append((x, y)) v.sort(key = cmp_to_key(arg_sort)) if(n == 1): print((gcd(v[0][0], v[0][1]) + 1) % mod) exit(0) S, bh = 0, 0 lx, ly = 0, 0 for x, y in v: v1 = (lx, ly) v2 = ((lx + x) % mod, (ly + y) % mod) S += area(v1, v2) S %= mod bh += gcd(x, y) bh %= mod lx, ly = v2 ans = (S + bh + 1) % mod print(ans)