import sys
from fractions import Fraction
from collections import Counter

def solve(N, m):
    AB_fr = []
    for a, b in zip(m, m):
        if (a, b) != (0, 0):
            AB_fr.append(Fraction(a, b))
    if len(AB_fr) == 0:
        return 1
    ans = 1
    mod = 10**9+7
    Cnt = Counter(AB_fr)
    for ab_fr, cnt in Cnt.items():
        cnt2 = Cnt[-1/ab_fr]
        if ab_fr < 0 and cnt2 > 0:
            continue
        p = pow(2, cnt, mod)
        p2 = pow(2, cnt2, mod)
        ans = ans * (p + p2 - 1) % mod
    return (ans - 1) % mod

def main():
    N = int(sys.stdin.buffer.readline())
    m = map(int, sys.stdin.buffer.read().split())
    ans = solve(N, m)
    print(ans)

main()
