#include<bits/stdc++.h>
#define ll                  long long
#define dl                 double
#define pb                push_back
#define F                  first
#define S                  second
#define endl              "\n"
#define rep(i,a,b)       for(i=a;i<b;i++)
#define all(v)             v.begin(),v.end()
#define allr(v)            v.rbegin(),v.rend()
#define mod              1000000007LL
#define CIN(V,s,n)      for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n)   {for(int i=s;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);      for(ll i=0;i<V.size();i++) V[i] = 0;
#define N                  105
#define tmod             998244353LL
using namespace std;

bool sBs(const pair<int,int> &a,const pair<int,int> &b)
{   return (a.second < b.second);   }

ll SUMD(ll n);
ll BS(vector<pair< ll ,ll > > &PS,ll s,ll e,ll ser);
ll MI(ll a, ll m);
ll P[N+1];
void Sieve(int n=N);
ll Powb(ll b,ll n,ll m);

int main()
{
fast;
ll q=1,t;
//cin >> q; t = q;
while(q--)
{
    ll i,j,n,m,k,l,r,a=0,b=0,c=0,d=0,e,g=1,p,u,v,w,x,y,flag=1;
    //n=m=k=i=j=l=r=a=b=c=d=u=v=w=p=x=y=0;
    cin >> n;
    map<pair<ll,ll>,int > M;
    map<pair<ll,ll>,int > C;
    for(i=0;i<n;i++)
    {
        cin >> u >> v;
        if(u!=0 and v!=0)
            g = __gcd(u,v);
        else g=1;
        if(g!=0)
            {u /= g; v /= g;}
        if( (u<0 and v>0) or (u>0 and v<0) )
        {
            u = -abs(u);
            v = abs(v);
            M[{u,v}]++;
        }
        else if(u==0 or v==0 )
        {
            if(u==0 and v==0) c++;
            else if(u==0) a++;
            else b++;
        }
        else
        {
            u = abs(u);
            v = abs(v);
            M[{u,v}]++;
        }
    }
    ll ans = (Powb(2,a,mod) - 1 + Powb(2,b,mod)) % mod;
    for(auto it:M)
    {
        u = it.F.F; v = it.F.S; //cout << u << " " << v << endl;
        if( (u<0 and v>0) or (u>0 and v<0) )
        {
            v = abs(it.F.F);
            u = abs(it.F.S);
        }
        else
        {
            v = -abs(it.F.F);
            u = abs(it.F.S);
        }
        if(C[{u,v}]==0 and C[it.F]==0)
        {
            //cout << u <<  " " << v << endl;
            x =  Powb(2,it.S,mod) ;
            if(M.find({u,v}) != M.end())
                {x +=  Powb(2,M[{u,v}],mod) -1;}// cout << "YEs" ;}
            ans = (ans*(  (x) % mod) )%mod;
        }
       // cout << ans <<  " ";
        C[{u,v}]=1; C[it.F]=1;
    }
    cout << (ans + (c>=1) - 1)%mod;
}
    return 0;
}

//*****************************************************************************************************************************************

ll Powb(ll b,ll n,ll m)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2,m);
    if(n%2==0){return (temp*temp)%m;}
    else{return (b*((temp*temp)%m))%m;}
}

ll SUMD(ll n)
{   ll sum=0;
    while(n>0){sum += n%10;n = n/10;}
    return sum;

}
ll BS(vector<pair<ll,ll> > &PS,ll s,ll e,ll ser)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    if(PS[mid].F==ser)
    {
        return mid;
    }
    else if(PS[mid].F > ser)
    {
        return BS(PS,s,mid-1,ser);
    }
    else
        return BS(PS,mid+1,e,ser);
}
ll MI(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}

void Sieve(int n)
{
    //memset(P,true,sizeof(P));
    //P[0] = false;
    //P[1]= false;
    for(int i=1;i<=n;i++) P[i] = i;
    for(ll i=2;i*i<=n;i++)
    {
        if(P[i]==i)
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                if(P[j]==j)
                    P[j]=i;
            }
        }
    }

}

