"""
https://sen-comp.hatenablog.com/entry/2020/05/18/010611
"""

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

MOD = 1000000007

dic1 = {}
dic2 = {}
a_zero = 0
b_zero = 0
both_zero = 0

for a, b in AB:
    if a == 0 and b != 0:
        a_zero += 1
    elif a != 0 and b == 0:
        b_zero += 1
    elif a == 0 and b == 0:
        both_zero += 1
    else:
        s = a / b
        t = -b / a

        if s in dic1:
            dic1[s] += 1
        else:
            dic1[s] = 1

        if t in dic2:
            dic2[t] += 1
        else:
            dic2[t] = 1

pair = {}

for val1, cnt1 in dic1.items():
    val2 = - 1 / val1
    cnt2 = dic2.get(val1, 0)

    if val1 < val2:
        if (val1, val2) not in pair:
            pair[(val1, val2)] = (cnt1, cnt2)
    else:
        if (val2, val1) not in pair:
            pair[(val2, val1)] = (cnt2, cnt1)

all_cnt = 1
for _, y in pair.items():
    all_cnt *= pow(2, y[0], MOD) + pow(2, y[1], MOD) - 1
    all_cnt = all_cnt % MOD


all_cnt *= pow(2, a_zero, MOD) + pow(2, b_zero, MOD) - 1
all_cnt = all_cnt % MOD

all_cnt += both_zero

print((all_cnt - 1) % MOD)
