from math import gcd

from collections import Counter



mod = 10 ** 9 + 7



N, *AB = list(map(int, open(0).read().split()))



def std(a, b):

    if a == 0:

        return (0, int(b != 0))



    g = gcd(a, b)

    a, b = a // g, b // g

    return (a, b) if a > 0 else (-a, -b)



C = Counter()

for a, b in zip(*[iter(AB)] * 2):

    C[std(a, b)] += 1



ans = 1

cnt = 0

for (a, b), v in list(C.items()):

    if b > 0:

        if (b, -a) in C:

            ans *= -1 + pow(2, v, mod) + pow(2, C[(b, -a)], mod)

            ans %= mod

        else:

            cnt += v

    elif (-b, a) not in C:

        cnt += v



ans *= pow(2, cnt, mod)

ans += C[(0, 0)] - 1



print((ans % mod))
from math import gcd

from collections import Counter



mod = 10 ** 9 + 7



N, *AB = list(map(int, open(0).read().split()))



def std(a, b):

    if a == 0:

        return (0, int(b != 0))



    g = gcd(a, b)

    a, b = a // g, b // g

    return (a, b) if a > 0 else (-a, -b)



C = Counter(std(a, b) for a, b in zip(*[iter(AB)] * 2))



ans = 1

cnt = 0

for (a, b), v in list(C.items()):

    if b > 0:

        if (b, -a) in C:

            ans *= -1 + pow(2, v, mod) + pow(2, C[(b, -a)], mod)

            ans %= mod

        else:

            cnt += v

    elif (-b, a) not in C:

        cnt += v



ans *= pow(2, cnt, mod)

ans += C[(0, 0)] - 1



print((ans % mod))
from math import gcd
from collections import Counter

mod = 10**9 + 7
N, *AB = list(map(int, open(0).read().split()))


def std(a, b):
    if a == 0:
        return (0, int(b != 0))
    g = gcd(a, b)
    a, b = a // g, b // g
    return (a, b) if a > 0 else (-a, -b)


C = Counter()
for a, b in zip(*[iter(AB)] * 2):
    C[std(a, b)] += 1
ans = 1
cnt = 0
for (a, b), v in list(C.items()):
    if b > 0:
        if (b, -a) in C:
            ans *= -1 + pow(2, v, mod) + pow(2, C[(b, -a)], mod)
            ans %= mod
        else:
            cnt += v
    elif (-b, a) not in C:
        cnt += v
ans *= pow(2, cnt, mod)
ans += C[(0, 0)] - 1
print((ans % mod))

from math import gcd
from collections import Counter

mod = 10**9 + 7
N, *AB = list(map(int, open(0).read().split()))


def std(a, b):
    if a == 0:
        return (0, int(b != 0))
    g = gcd(a, b)
    a, b = a // g, b // g
    return (a, b) if a > 0 else (-a, -b)


C = Counter(std(a, b) for a, b in zip(*[iter(AB)] * 2))
ans = 1
cnt = 0
for (a, b), v in list(C.items()):
    if b > 0:
        if (b, -a) in C:
            ans *= -1 + pow(2, v, mod) + pow(2, C[(b, -a)], mod)
            ans %= mod
        else:
            cnt += v
    elif (-b, a) not in C:
        cnt += v
ans *= pow(2, cnt, mod)
ans += C[(0, 0)] - 1
print((ans % mod))

-C = Counter() -for a, b in zip(*[iter(AB)] * 2): -    C[std(a, b)] += 1 +C = Counter(std(a, b) for a, b in zip(*[iter(AB)] * 2))