#include<bits/stdc++.h>
#define int long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define repr(i,x,y) for(int i=x;i>=y;i--) 
#define mod 1000000007
#define ff first
#define ss second
using namespace std;
long long pow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
void Onigiri()
{
  int n;
  cin>>n;
  int ok=0;
  map<pair<int,pair<int,int>>,int>mpp;
  int za=0,zb=0,zab=0;
  rep(i,0,n)
  {
    int x,y;
    cin>>x>>y;
    
    if(x==0&&y==0){zab++;continue;}
    if(x==0){za++;continue;}
    if(y==0){zb++;continue;}

    int g=__gcd(abs(x),abs(y));
    x/=g;
    y/=g;
    if((x<0&&y<0)||(x>0&&y>0))
      mpp[{abs(x),{abs(y),1}}]++;
    else mpp[{abs(x),{abs(y),-1}}]++;
  }

  int tot=0;

  for(auto x:mpp)
    tot+=x.ss;
  tot+=za;
  tot+=zb;
  int ans=max(1LL,zab);
  set<pair<int,pair<int,int>>>s;
  for(auto x:mpp)
  {
    if(s.find(x.first)!=s.end())continue;
    int a=x.ff.ff;
    int b=x.ff.ss.ff;
    int sign=x.ff.ss.ss;
    int num1=x.ss;
    int tot2=tot;
    if(mpp.find({b,{a,sign*(-1)}})!=mpp.end()){

      int num2=mpp[{b,{a,sign*(-1)}}];
      int p2=(pow(2LL,num2,mod));
      int p1=(pow(2LL,num1,mod));
      ans=(ans*((p1+p2-1+mod)%mod))%mod;
      s.insert({b,{a,sign*(-1)}});
      s.insert({a,{b,sign}});
    
    }
    else {
      int p1=(pow(2LL,num1,mod));
      ok=1;
      ans=(ans*(p1)%mod)%mod;
    }
  }

  int p1=(pow(2LL,za,mod));
  int p2=(pow(2LL,zb,mod));
  if(za>0&&zb>0)ans=(ans*((p1+p2-1+mod)%mod))%mod;
  else if(za>0||zb>0){ok=1;ans=((ans*p1)%mod*p2)%mod;}
  cout<<(ans-(zab-1)+mod)%mod;
}
signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(NULL);
   #ifdef Zoro
   freopen("in", "r", stdin);freopen("out", "w", stdout);
   #endif  
 
   int t=1; 
    //cin>>t;
 
   while(t--)
   {Onigiri();cout<<"\n";}

   cerr<<"\n"<<(float)clock()/CLOCKS_PER_SEC*1000<<" ms"<<endl;
   return 0;
}