#include<bits/stdc++.h>
#define pb push_back
#define ll long long 
using namespace std;
const int mod=1e9+7;
 
ll modpow(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1)res*=a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return res%mod;
}
 
 
 
int main(){
  int n,cnt=0;cin>>n;
  map<pair<ll,ll>,pair<int,int>>m;
  
  for(int i=0;i<n;i++){
    ll a,b;
    cin>>a>>b;
    if(!a&&!b){cnt++;continue;}
    
    ll g=__gcd(a,b);
    a/=g;b/=g;
   
    if(b<0)a=-a,b=-b;
    
    if(a<=0)m[{b,-a}].second++;
    else m[{a,b}].first++;
  }
    ll ans=1;
    for(auto u:m){
        ans=(ans*(modpow(2,u.second.first)+modpow(2,u.second.second)-1+mod)%mod)%mod;
    }
    cout<<(ans-1+cnt+mod)%mod;
    return 0;
  
  
  
 
}