import sys
input = sys.stdin.buffer.readline
from collections import defaultdict
MOD = 10**9+7

def main():
    n = int(input())
    ans = 1
    C = defaultdict(int)
    z = 0
    for i in range(n):
        a, b = map(int, input().split())
        if b == 0:
            z += 1
        else:
            C[a/b] += 1
    D = tuple(C.items())
    used = {0}
    for c, v in D:
        if c in used:
            continue
        ans *= (pow(2, v, MOD)+pow(2, C[-(1/c)], MOD)-1)
        ans %= MOD
        used.add(-(1/c))
    ans *= (pow(2, C[0], MOD)+pow(2, z, MOD)-1)
    ans -= 1
    ans %= MOD
    print(ans)

if __name__ == "__main__":
    main()