import sys
from collections import defaultdict
from math import gcd

def read():
    return sys.stdin.readline().rstrip()

def main():
    n = int(read())
    mod = 1000000007
    a = defaultdict(int)
    for _ in range(n):
        _a, _b = map(int, read().split())
        if _a == 0 and _b == 0:
            continue
        _g = gcd(_a, _b)
        if _a == 0:
            _b = 1
            _g = 1
        elif _b == 0:
            _a = 1
            _g = 1
        elif _a < 0:
            _a = -_a
            _b = -_b
        a[(_a // _g, _b // _g)] += 1
    keys = a.keys()
    p = 0
    t = []
    s = set()
    for _a, _b in keys:
        if (_a, _b) in s:
            continue
        if _a == 0 and ((1, 0) in keys):
            t.append((a[(0, 1)], a[1, 0]))
            s.add((0, 1))
            s.add((1, 0))
        elif _b > 0 and ((_b, -_a) in keys):
            t.append((a[(_a, _b)], a[(_b, -_a)]))
            s.add((_a, _b))
            s.add((_b, -_a))
        elif _b < 0 and ((-_b, _a) in keys):
            t.append((a[(_a, _b)], a[(-_b, _a)]))
            s.add((_a, _b))
            s.add((-_b, _a))
        else:
            p += a[(_a, _b)]
    c = pow(2, p, mod)
    for ta, tb in t:
        c = c * (pow(2, ta, mod) + pow(2, tb, mod) - 1) % mod
    print(c - 1)
    
if __name__ == '__main__':
    main()