#include<bits/stdc++.h>
using namespace std;
 
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define endl "\n"
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define ll long long
#define MOD 1000000007
#define pi 3.141592653589 
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
ll me(ll x,ll y,ll p)
{
  ll res=1;
  x=x%p;
  if(x==0)return 0;
  while(y>0)
  {
      if(y%2)
      {
          res=res*x;
      }
     y= y>>1;
      x=(x*x)%p;
     // cout<<y;   
  }
return res;
}
int main()
{
 
int n,nn;cin>>n;nn=n;
ll a,b,ans,a_0=0,b_0=0;
map<pair<ll,ll>,int>jp;
for(int i=0;i<n;i++)
{
    cin>>a>>b;
    int co=0;
    if(a==0&&b==0)
    {
        nn--;continue;
    }
    if(a<0){co++;
    a*=-1;
    }
    if(b<0)
    {co++;
    b*=-1;}
    if(a==0)
    {
        a_0++;continue;
    }
    if(b==0)
    {
        b_0++;continue;
    }
    ll g=__gcd(a,b);
    if(co!=1)
    {
        if(jp.find(MP(a/g,b/g))==jp.end())
        {
            jp[MP(a/g,b/g)]=1;
        }else
        {
            jp[MP(a/g,b/g)]++;/* code */
        }
        
    }else
    {
        if(jp.find(MP((-1*a)/g,b/g))==jp.end())
        {
            jp[MP((a*-1)/g,b/g)]=1;
        }else
        {
            jp[MP((-1*a)/g,b/g)]++;/* code */
        }
    } 
    

}
 
ans=(me(2,a_0,MOD)+me(2,b_0,MOD)-1) ;

 
for(auto it=jp.begin();it!=jp.end();it++)
{   
    
    //cout<<it->first.first<<" "<<it->first.second<<" "<<it->second<<"\n";
    pair<ll,ll>dum;
    if(it->FF.FF<0)
    {
        dum=MP(it->FF.SS,-1*it->FF.FF);
    }else
    {
         dum=MP(-1*it->FF.SS,it->FF.FF);
    }
     
    if(jp.find(dum)!=jp.end())
    {
        ans= ans*((me(2,jp[MP(it->FF.FF,it->FF.SS)],MOD) +me(2,jp[dum],MOD)-1))%MOD;
        ans=ans%MOD;
        jp.erase(dum);
    }else
    {
        ans= ans*((me(2,jp[MP(it->FF.FF,it->FF.SS)],MOD)))%MOD;
        ans=ans%MOD;
    }
    
}
cout<<ans-1;
 

 

 
return 0;
   
}