from sys import stdin, setrecursionlimit
input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi, radians, sin, cos

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

MOD = 10 ** 9 + 7
INF = 10 ** 18

N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]

cnt = defaultdict(int)
zero = 0

tmp = []
for a, b in AB:
    if a * b == 0:
        tmp.append([a, b])
    else:
        gcd_ab = gcd(abs(a), abs(b))
        if a < 0: a,  b = - a, - b 
        tmp.append([a // gcd_ab, b // gcd_ab])
AB = tmp
#print(AB)

cnt = defaultdict(int)
zero = 0
        
for a, b in AB:
    if a * b == 0:
        zero += 1
    else:
        cnt[(a, b)] += 1
#print(cnt)

answer = 1
rest = N

answer *= zero + 1
answer %= MOD
rest -= zero

check = defaultdict(int)
for a, b in AB:
    if a > 0 and b > 0 and check[(a, b)] == 0:
        check[(a, b)] = 1
        #print((a, b), cnt[(a, b)], cnt[(b, -a)])
        answer *= pow(2, cnt[(a, b)] + cnt[(b, -a)], MOD) - (pow(2, cnt[(a, b)], MOD) - 1) * (pow(2, cnt[(b, -a)], MOD) - 1) 
        answer %= MOD
        rest -= cnt[(a, b)] + cnt[(b, -a)]

answer *= pow(2, rest, MOD)
answer -= 1
answer %= MOD

print(answer)