from math import gcd

from collections import Counter

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines



MOD = 10**9+7



def main():

    N,*ab = list(map(int, read().split()))



    ab_zero = 0

    ratio = []

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

        if a == 0 and b == 0:

            ab_zero += 1

        else:

            g = gcd(a, b)

            a //= g

            b //= g

            ratio.append((a, b))

    ab_zero %= MOD

    

    s = Counter(ratio)



    bad = 1

    for k, v in list(s.items()):

        if v == 0:

            continue

        

        a, b = k

        if (-a, -b) in s:

            v += s[(-a, -b)]

            s[(-a, -b)] = 0



        inv = 0

        if (-b, a) in s:

            inv += s[(-b, a)]

            s[(-b, a)] = 0

        if (b, -a) in s:

            inv += s[(b, -a)]

            s[(b, -a)] = 0



        bad *= (pow(2, v, MOD) + pow(2, inv, MOD) -1) % MOD

        bad %= MOD

        s[k] = 0



    ans = (bad + ab_zero -1) % MOD

    print(ans)

    



if __name__ == "__main__":

    main()

from math import gcd

from collections import Counter

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines



MOD = 10**9+7



def main():

    N,*ab = list(map(int, read().split()))



    ab_zero = 0

    ratio = []

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

        if a == 0 and b == 0:

            ab_zero += 1

        else:

            if b < 0:

                a, b = -a, -b

            if b == 0:

                a = 1

            g = gcd(a, b)

            a //= g

            b //= g

            ratio.append((a, b))

    ab_zero %= MOD

    

    s = Counter(ratio)



    bad = 1

    for k, v in list(s.items()):

        if v == 0:

            continue

        a, b = k

        if (-b, a) in s:

            bad *= (pow(2, v, MOD) + pow(2, s[(-b, a)], MOD) -1) % MOD

            bad %= MOD            

            s[(-b, a)] = 0

        elif (b, -a) in s:

            bad *= (pow(2, v, MOD) + pow(2, s[(b, -a)], MOD) -1) % MOD

            bad %= MOD            

            s[(b, -a)] = 0

        else:

            bad *= pow(2, v, MOD)

            bad %= MOD            

        s[k] = 0



    ans = (bad + ab_zero -1) % MOD

    print(ans)

    



if __name__ == "__main__":

    main()

from math import gcd
from collections import Counter
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MOD = 10**9 + 7


def main():
    N, *ab = list(map(int, read().split()))
    ab_zero = 0
    ratio = []
    for a, b in zip(*[iter(ab)] * 2):
        if a == 0 and b == 0:
            ab_zero += 1
        else:
            g = gcd(a, b)
            a //= g
            b //= g
            ratio.append((a, b))
    ab_zero %= MOD
    s = Counter(ratio)
    bad = 1
    for k, v in list(s.items()):
        if v == 0:
            continue
        a, b = k
        if (-a, -b) in s:
            v += s[(-a, -b)]
            s[(-a, -b)] = 0
        inv = 0
        if (-b, a) in s:
            inv += s[(-b, a)]
            s[(-b, a)] = 0
        if (b, -a) in s:
            inv += s[(b, -a)]
            s[(b, -a)] = 0
        bad *= (pow(2, v, MOD) + pow(2, inv, MOD) - 1) % MOD
        bad %= MOD
        s[k] = 0
    ans = (bad + ab_zero - 1) % MOD
    print(ans)


if __name__ == "__main__":
    main()

from math import gcd
from collections import Counter
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MOD = 10**9 + 7


def main():
    N, *ab = list(map(int, read().split()))
    ab_zero = 0
    ratio = []
    for a, b in zip(*[iter(ab)] * 2):
        if a == 0 and b == 0:
            ab_zero += 1
        else:
            if b < 0:
                a, b = -a, -b
            if b == 0:
                a = 1
            g = gcd(a, b)
            a //= g
            b //= g
            ratio.append((a, b))
    ab_zero %= MOD
    s = Counter(ratio)
    bad = 1
    for k, v in list(s.items()):
        if v == 0:
            continue
        a, b = k
        if (-b, a) in s:
            bad *= (pow(2, v, MOD) + pow(2, s[(-b, a)], MOD) - 1) % MOD
            bad %= MOD
            s[(-b, a)] = 0
        elif (b, -a) in s:
            bad *= (pow(2, v, MOD) + pow(2, s[(b, -a)], MOD) - 1) % MOD
            bad %= MOD
            s[(b, -a)] = 0
        else:
            bad *= pow(2, v, MOD)
            bad %= MOD
        s[k] = 0
    ans = (bad + ab_zero - 1) % MOD
    print(ans)


if __name__ == "__main__":
    main()

+            if b < 0: +                a, b = -a, -b +            if b == 0: +                a = 1 -        if (-a, -b) in s: -            v += s[(-a, -b)] -            s[(-a, -b)] = 0 -        inv = 0 -            inv += s[(-b, a)] +            bad *= (pow(2, v, MOD) + pow(2, s[(-b, a)], MOD) - 1) % MOD +            bad %= MOD -        if (b, -a) in s: -            inv += s[(b, -a)] +        elif (b, -a) in s: +            bad *= (pow(2, v, MOD) + pow(2, s[(b, -a)], MOD) - 1) % MOD +            bad %= MOD -        bad *= (pow(2, v, MOD) + pow(2, inv, MOD) - 1) % MOD -        bad %= MOD +        else: +            bad *= pow(2, v, MOD) +            bad %= MOD