#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1000000007;
int p2(int B){
  if(!B)return 1;
  if(B&1)return p2(B-1)*2%mod;
  int C=p2(B/2);
  return C*C%mod;
}
signed main(){
  int N;
  cin>>N;
  map<pair<int,int>,int> mp;
  int ans=0,ans2=1;
  for(int i=0;i<N;i++){
    int a,b;
    cin>>a>>b;
    if(a==0 && b==0){
      ans++;
      continue;
    }
    int n=gcd(a,b);
    a/=n,b/=n;
    if(b<0)a*=-1,b*=-1;
    if(!b && a<0)a*=-1;
    mp[make_pair(a,b)]++;
  }
  for(pair<pair<int,int>,int> p:mp){
    if(!mp.count(make_pair(p.first.second,-p.first.first)) && !mp.count(make_pair(-p.first.second,p.first.first)))
      ans2=ans2*p2(p.second)%mod;
    else if(p.first.first<=0)
      ans2=ans2*((p2(p.second)+p2(mp[make_pair(p.first.second,-p.first.first)])-1)%mod)%mod;
  }
  cout<<(ans+ans2-1)%mod<<endl;
}