import sys
readline = sys.stdin.readline
from collections import defaultdict

def gcd(a, b):
    if a == 0:
        return b
    return gcd(b % a, a)
 
def main():
    n = int(readline())
    x, y  = [], []
    add = 0
    for i in range(n):
        a, b = map(int, readline().split())
        if a == 0 and b == 0:
            add += 1
            continue
        x.append(a)
        y.append(b)

    p = []
    index = 0
    for a, b in zip(x, y):
        cx = a
        cy = b
        if (-cx, -cy) > (cx, cy):
            cx = -cx
            cy = -cy
        g = gcd(abs(cx), abs(cy))
        cx /= g
        cy /= g
        p.append((cx, cy, 1, index))
        
        cx = b
        cy = -a
        if (-cx, -cy) > (cx, cy):
            cx = -cx
            cy = -cy
        g = gcd(abs(cx), abs(cy))
        cx /= g
        cy /= g
        p.append((cx, cy, 2, index))

        index += 1

    mod = 1000000007

    def GetValue(group):
        min1 = 10 ** 10
        min2 = 10 ** 10
        pow1 = 1
        pow2 = 1
        for g in group:
            _, __, t, i = g
            if t == 1:
                min1 = min(min1, i)
                pow1 = pow1 * 2 % mod
            else:
                min2 = min(min2, i)
                pow2 = pow2 * 2 % mod
        result = (pow1 + pow2 - 1 + mod) % mod
        if min1 > min2:
            result = 1
        #print group, result
        return result

    m = dict()
    for t in p:
        x1, y1, _, __ = t
        if (x1, y1) not in m:
            m[(x1, y1)] = []
        m[(x1, y1)].append(t)

    result = 1
    for group in m.itervalues():
        result = result * GetValue(group) % mod 

    result = max(0, result - 1)

    print(result + add)


if __name__ == "__main__":
    main()
