from collections import defaultdict
from math import gcd

def main():
    n = int(input())
    mod = 1000000007
    zeroes = 0
    quad1 = defaultdict(int)
    quad2 = defaultdict(int)
    for _ in range(n):
        a, b = map(int, input().split())
        g = gcd(a, b)
        a, b = a//g, b//g

        if a == b == 0:
            zeroes += 1
            continue
        
        if b < 0:
            a, b = -a ,-b
        
        if a <= 0:
            a, b = b, -a
            quad1[(a,b)] += 0
            quad2[(a,b)] += 1
        else:
            quad1[(a,b)] += 1
            quad2[(a,b)] += 0

    ans = 1
    for k, v in quad1.items():
        now = 1
        now += pow(2, v, mod) -1
        now += pow(2, quad2[k], mod) -1
        ans = ans * now % mod
    
    ans += (zeroes - 1)
    print (ans % mod)


if __name__ == '__main__':
    main()