from collections import defaultdict
import math
MOD = 10 ** 9 + 7

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    N = Z()
    AB = [ZZ() for _ in range(N)]
    AB = [[a, b] for a, b in AB if a != 0 or b != 0] # 零ベクトルは除外
    cnt_0 = N - len(AB) # 零ベクトルの個数
    vec = defaultdict(int) # ベクトル個数の管理

    #既約化
    for i in range(len(AB)):
        a, b = AB[i]
        if a < 0: a, b = -a, -b
        g = math.gcd(a, b)
        a //= g
        b //= g
        vec[(a, b)] += 1

    output = 1
    used = set()
    for v in vec.keys():
        if v in used: continue
        a, b = v
        inv = (-b, a) if b < 0 else (b, -a)
        if inv in vec.keys():
            output *= (pow(2, vec[v], MOD) + pow(2, vec[inv], MOD) - 1)
        else: output *= pow(2, vec[v], MOD)
        output %= MOD
        used.add(v)
        used.add(inv)

    output += cnt_0 - 1
    print(output)
    return

if __name__ == '__main__':
    main()
