from decimal import *
MOD = 1000000007

def solve(N, ABs):
    groups = {}
    L = 10**18
    zero_count = 0
    for a, b in ABs:
        if a == 0 and b == 0:
            zero_count += 1
            continue
        if b == 0:
            k = "INF"
        else:
            k = Decimal(a) / Decimal(b)
        groups.setdefault(k, 0)
        groups[k] += 1

    visited = set()
    possibles = []
    for k, v in groups.items():
        if k in visited:
            continue
        p = 0
        p += pow(2, v, MOD)
        if k == "INF":
            m = 0
        elif k == 0:
            m = "INF"
        else:
            m = - (Decimal(1) / Decimal(k))
        if m in groups.keys():
            p += pow(2, groups[m], MOD)
            visited.add(m)
            p -= 1
        possibles.append(p % MOD)

    ans = 1
    for p in possibles:
        ans *= p
        ans %= MOD

    if zero_count:
        ans += zero_count
        ans %= MOD
    return ans - 1


def slow_solve(N, ABs):
    import itertools
    ans = 0
    for k in range(1, 2**N):
        b = ("{:0" + str(N) + "b}").format(k)
        taken = []
        for i, c in enumerate(b):
            if c == "1":
                taken.append(ABs[i])

        if len(taken) == 1:
            ans += 1
        elif all(comb[0][0] * comb[1][0] + comb[0][1] * comb[1][1] != 0
                 for comb in itertools.combinations(taken, 2)):
            ans += 1
    return ans

# print(slow_solve(3,
#       [(1, 2), (-1, 1), (2, -1)]))
#
# print(slow_solve(10,
#       [(3, 2), (3, 2), (-1, 1), (2, -1), (-3, -9), (-8, 12), (7, 7), (8, 1), (8, 2), (8, 4)]))

# print(slow_solve(3, [(7, 9), (-9, 7), (-4, -2)]))
# print(solve(3, [(7, 9), (-9, 7), (-4, -2)]))
# input()
#
# def create(N):
#     import random
#     ABs = []
#     MM = 1000
#     for _ in range(N):
#         ABs.append( (random.randint(-MM, MM), random.randint(-MM, MM)))
#     return ABs
#
# for _ in range(100):
#     for N in range(1, 10):
#         ABs = create(N)
#         if solve(N, ABs) != slow_solve(N, ABs):
#             print("ERROR")
#             print(N)
#             print(ABs)
#             break
#
# print("OK")


if __name__ == "__main__":
    N = int(input())
    ABs = [tuple(map(int, input().split(" "))) for _ in range(N)]
    print(solve(N, ABs))
