MOD = 10**9+7
class mint:
    def __init__(self, x):
        self.x = x % MOD if isinstance(x, int) else int(x) % MOD
    def __str__(self):
        return str(self.x)
    __repr__ = __str__
    def __iadd__(self, other):
        self.x += other.x if isinstance(other, mint) else other
        self.x -= MOD if self.x >= MOD else 0
        return self
    def __isub__(self, other):
        self.x += MOD-other.x if isinstance(other, mint) else MOD-other
        self.x -= MOD if self.x >= MOD else 0
        return self
    def __imul__(self, other):
        self.x *= other.x if isinstance(other, mint) else other
        self.x %= MOD
        return self
    def __imod__(self, other):
        self.x %= other.x if isinstance(other, mint) else other
        self.x %= MOD
        return self
    def __add__(self, other):
        return (
            mint(self.x + other.x) if isinstance(other, mint) else
            mint(self.x + other)
        )
    def __sub__(self, other):
        return (
            mint(self.x - other.x) if isinstance(other, mint) else
            mint(self.x - other)
        )
    def __mul__(self, other):
        return (
            mint(self.x * other.x) if isinstance(other, mint) else
            mint(self.x * other)
        )
    def __mod__(self, other):
        return (
            mint(self.x % other.x) if isinstance(other, mint) else
            mint(self.x % other)
        )
    def __truediv__(self, other):
        return (
            mint(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, mint) else
            mint(self.x * pow(other, MOD - 2, MOD))
        )
    def __pow__(self, other):
        return (
            mint(pow(self.x, other.x, MOD)) if isinstance(other, mint) else
            mint(pow(self.x, other, MOD))
        )
    __radd__ = __add__
    def __rsub__(self, other):
        return (
            mint(other.x - self.x) if isinstance(other, mint) else
            mint(other - self.x)
        )
    __rmul__ = __mul__
    def __rmod__(self, other):
        return (
            mint(other.x % self.x) if isinstance(other, mint) else
            mint(other % self.x)
        )
    def __rtruediv__(self, other):
        return (
            mint(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, mint) else
            mint(other * pow(self.x, MOD - 2, MOD))
        )
    def __rpow__(self, other):
        return (
            mint(pow(other.x, self.x, MOD)) if isinstance(other, mint) else
            mint(pow(other, self.x, MOD))
        )
import math

n = int(input())
a=[0]*n
b = [0]*n
for i in range(n):
    a[i],b[i] = map(int, input().split())

d=dict()
for i in range(n):
    g=math.gcd(a[i],b[i])
    if g!=1:
        a[i]//=g
        b[i]//=g
    if b[i]<0:
        a[i]*=-1
        b[i]*=-1
    if a[i]==0 or b[i]==0:
        a[i]=0
        b[i]=0
    try:
        d[(a[i],b[i])]+=1
    except:
        d[(a[i],b[i])]=1
ok=n
ls=[]
for ap,bp in d.keys():
    now = d[ap,bp]
    try:
        anow = ap
        bnow = bp
        if a[i]<0:
            anow*=-1
            bnow*=-1
        ok = ok-now-d[(-bnow,anow)]
        ng = d[(-bnow,anow)]
        ls.append(mint(pow(2,now,MOD))+mint(pow(2,ng,MOD)-1))
        d[ap,bp]=0
        d[(-bnow,anow)]=0
    except:
        pass

ans=mint(pow(2,ok,MOD))
for i in ls:
    ans*= i

ans-=1

print(ans)