from math import gcd
from collections import Counter
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

MOD = 10**9+7

def main():
    N,*ab = map(int, read().split())

    ab_zero = 0
    a_zero = 0
    b_zero = 0
    ratio = []
    for a, b in zip(*[iter(ab)]*2):
        if a == 0 and b == 0:
            ab_zero += 1
        elif a == 0:
            a_zero += 1
        elif b == 0:
            b_zero += 1
        else:
            g = gcd(a, b)
            a //= g
            b //= g
            ratio.append((a, b))
    
    s = Counter(ratio)

    bad = pow(2, a_zero, MOD) + pow(2, b_zero, MOD) - 1
    bad %= MOD
    for k, v in s.items():
        if v == 0:
            continue
        a, b = k
        inv = 0
        if (-b, a) in s:
            inv += s[(-b, a)]
            s[(-b, a)] = 0
        if (b, -a) in s:
            inv += s[(b, -a)]
            s[(b, -a)] = 0
        if inv:
            bad *= (pow(2, v, MOD) + pow(2, inv, MOD) -1) % MOD
            bad %= MOD
        else:
            bad *= pow(2, v, MOD)
            bad %= MOD

    ans = bad - 1 + ab_zero
    print(ans)
    

if __name__ == "__main__":
    main()
