from collections import defaultdict

import math





def main():

    n = int(eval(input()))

    mod = 1000000007

    zeroes = 0

    counter1 = defaultdict(int)

    counter2 = defaultdict(int)

    for _ in range(n):

        x, y = [int(x) for x in input().split()]



        if x == y == 0:

            zeroes += 1

            continue



        denominator = math.gcd(x, y)

        x, y = x // denominator, y // denominator



        if y < 0:

            # quadrant III, IV -> I, II

            x, y = -x, -y



        if x <= 0:

            # round 90° from quadrant II to I

            x, y = y, -x

            counter2[(x, y)] += 1

            counter1[(x, y)] += 0

        else:

            counter1[(x, y)] += 1

            counter2[(x, y)] += 0



    ans = 1

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

        now = 1

        now += pow(2, v, mod) - 1

        now += pow(2, counter2[k], mod) - 1

        ans = ans * now % mod

    ans += zeroes

    ans -= 1  # choose no fish

    return ans % mod





if __name__ == '__main__':

    print((main()))

from collections import defaultdict

import math



def main():

    n = int(eval(input()))

    mod = 1000000007

    zeroes = 0

    quadrant1 = defaultdict(int)

    quadrant2 = defaultdict(int)



    for _ in range(n):

        a, b = list(map(int, input().split()))

        if a == b == 0:

            zeroes += 1

            continue



        g = math.gcd(a, b)

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

        

        if b < 0:

            a, b = -a, -b

        

        if a <= 0:

            a, b = b, -a

            quadrant1[(a, b)] += 0

            quadrant2[(a, b)] += 1

        else:

            quadrant1[(a, b)] += 1

            quadrant2[(a, b)] += 0

    

    ans = 1

    for key, value in list(quadrant1.items()):

        now = 1

        now += pow(2, value, mod) - 1

        now += pow(2, quadrant2[key], mod) - 1

        ans = (ans * now) % mod

    

    ans += (zeroes - 1)

    return ans % mod



if __name__ == '__main__':

    print((main()))
from collections import defaultdict
import math


def main():
    n = int(eval(input()))
    mod = 1000000007
    zeroes = 0
    counter1 = defaultdict(int)
    counter2 = defaultdict(int)
    for _ in range(n):
        x, y = [int(x) for x in input().split()]
        if x == y == 0:
            zeroes += 1
            continue
        denominator = math.gcd(x, y)
        x, y = x // denominator, y // denominator
        if y < 0:
            # quadrant III, IV -> I, II
            x, y = -x, -y
        if x <= 0:
            # round 90° from quadrant II to I
            x, y = y, -x
            counter2[(x, y)] += 1
            counter1[(x, y)] += 0
        else:
            counter1[(x, y)] += 1
            counter2[(x, y)] += 0
    ans = 1
    for k, v in list(counter1.items()):
        now = 1
        now += pow(2, v, mod) - 1
        now += pow(2, counter2[k], mod) - 1
        ans = ans * now % mod
    ans += zeroes
    ans -= 1  # choose no fish
    return ans % mod


if __name__ == "__main__":
    print((main()))

from collections import defaultdict
import math


def main():
    n = int(eval(input()))
    mod = 1000000007
    zeroes = 0
    quadrant1 = defaultdict(int)
    quadrant2 = defaultdict(int)
    for _ in range(n):
        a, b = list(map(int, input().split()))
        if a == b == 0:
            zeroes += 1
            continue
        g = math.gcd(a, b)
        a, b = a // g, b // g
        if b < 0:
            a, b = -a, -b
        if a <= 0:
            a, b = b, -a
            quadrant1[(a, b)] += 0
            quadrant2[(a, b)] += 1
        else:
            quadrant1[(a, b)] += 1
            quadrant2[(a, b)] += 0
    ans = 1
    for key, value in list(quadrant1.items()):
        now = 1
        now += pow(2, value, mod) - 1
        now += pow(2, quadrant2[key], mod) - 1
        ans = (ans * now) % mod
    ans += zeroes - 1
    return ans % mod


if __name__ == "__main__":
    print((main()))

-    counter1 = defaultdict(int) -    counter2 = defaultdict(int) +    quadrant1 = defaultdict(int) +    quadrant2 = defaultdict(int) -        x, y = [int(x) for x in input().split()] -        if x == y == 0: +        a, b = list(map(int, input().split())) +        if a == b == 0: -        denominator = math.gcd(x, y) -        x, y = x // denominator, y // denominator -        if y < 0: -            # quadrant III, IV -> I, II -            x, y = -x, -y -        if x <= 0: -            # round 90° from quadrant II to I -            x, y = y, -x -            counter2[(x, y)] += 1 -            counter1[(x, y)] += 0 +        g = math.gcd(a, b) +        a, b = a // g, b // g +        if b < 0: +            a, b = -a, -b +        if a <= 0: +            a, b = b, -a +            quadrant1[(a, b)] += 0 +            quadrant2[(a, b)] += 1 -            counter1[(x, y)] += 1 -            counter2[(x, y)] += 0 +            quadrant1[(a, b)] += 1 +            quadrant2[(a, b)] += 0 -    for k, v in list(counter1.items()): +    for key, value in list(quadrant1.items()): -        now += pow(2, v, mod) - 1 -        now += pow(2, counter2[k], mod) - 1 -        ans = ans * now % mod -    ans += zeroes -    ans -= 1  # choose no fish +        now += pow(2, value, mod) - 1 +        now += pow(2, quadrant2[key], mod) - 1 +        ans = (ans * now) % mod +    ans += zeroes - 1