if __name__ == '__main__':
    from sys import stdin
    from collections import defaultdict
    # from collections import deque
    # from collections import Counter
    # import numpy as np
    import math
    # import random
    input = stdin.readline

    p = 1000000007

    def pow_k(x, n):
        """
        O(log n)
        """
        if n == 0:
            return 1

        K = 1
        while n > 1:
            if n % 2 != 0:
                K *= x
            x *= x
            x = x%p
            n //= 2

        return (K * x)%p

    n = int(input())
    ab_0 = 0
    a_0 = 0
    b_0 = 0
    a_div_b_dict = defaultdict(int)
    for _ in range(n):
        a, b = map(int, input().split())
        if a == 0 and b == 0:
            ab_0 += 1
            continue
        if a == 0:
            a_0 += 1
            continue
        if b == 0:
            b_0 += 1
            continue
        if a*b > 0:
            front = ''
        else:
            front = '-'
        ab_gcd = math.gcd(a, b)
        a = str(abs(a//ab_gcd))
        b = str(abs(b//ab_gcd))
        a_div_b_dict[front+a.zfill(6)+b.zfill(6)] += 1
    # print(a_div_b_dict)
    visited = set()
    ans = 1
    for_loop = dict(a_div_b_dict)
    for key, value in for_loop.items():
        # print(visited)
        if key in visited:
            continue
        if key[0] == '-':
            front = key[1:7]
            back = key[7:]
            inverse = back + front
            visited.add(inverse)
            num = pow_k(2, value) + pow_k(2, a_div_b_dict[inverse])-1
            ans = (ans*num)%p
        else:
            front = key[:6]
            back = key[6:]
            inverse = '-' + back + front
            visited.add(inverse)
            num = pow_k(2, value) + pow_k(2, a_div_b_dict[inverse])-1
            ans = (ans*num)%p
    ans *= (pow_k(2, a_0) + pow_k(2, b_0)-1)
    ans += ab_0
    print((ans-1)%p)


"""            visited.add(key)
            num = pow_k(2, value) + pow_k(2, a_div_b_dict[key])-1
"""

