#include <bits/stdc++.h>
using namespace std;

#define int long long
const int MOD=1e9+7;
int pw(int n,int k){
  assert(k>=0);
  int res=1;
  while(k){
    if(k&1)(res*=n)%=MOD;
    (n*=n)%=MOD;
    k>>=1;
  }
  return res;
}
typedef pair<int,int> P;
int n;
vector<int> A,B;
int solve(){
  map<P,int> m;
  int f=0;
  for(int i=0;i<n;i++){
    int a=A[i],b=B[i];
    if(a==0&&b==0){f++;continue;}
    int g=__gcd(a,b);
    a/=g;b/=g;
    if(a<0)a*=-1,b*=-1;
    if(!a)b=1;
    if(!b)a=1;
    m[P(a,b)]++;
  }
  int ans=1;
  for(auto p:m){
    int a=p.first.first,b=p.first.second;
    int c=-b,d=a;
    if(c<0)c*=-1,d*=-1;
    if(m.count(P(c,d))){
      if(b>0)(ans*=pw(2,m[P(a,b)])+pw(2,m[P(c,d)])-1)%=MOD;
    }
    else (ans*=pw(2,m[P(a,b)]))%=MOD;
  }
  return ans+f-1;
}
int solve2(){
  int res=0;
  for(int i=1;i<(1<<n);i++){
    int out=0;
    for(int j=0;j<n;j++){
      if(((i>>j)&1)==0)continue;
      for(int k=0;k<j;k++){
        if(((i>>k)&1)==0)continue;
        if(A[j]*A[k]+B[j]*B[k]==0)out=1;
      }
    }
    if(!out)res++;
  }
  return res;
}

signed main(){
  cin>>n;
  for(int i=0;i<n;i++){
    int a,b;cin>>a>>b;
    A.push_back(a);
    B.push_back(b);
  }
  cout<<solve()<<endl;return 0;
  for(int i=0;i<100;i++){
    n=rand()%20+1;
    A.clear();B.clear();
    for(int i=0;i<n;i++){
      int a=rand()%3;
      int b=rand()%3;
      if(rand()&1)a*=-1;
      if(rand()&1)b*=-1;
      A.push_back(a);
      B.push_back(b);
    }
    if(solve()!=solve2()){
      cout<<n<<endl;
      for(int i=0;i<n;i++)cout<<A[i]<<" "<<B[i]<<endl;
      cout<<solve()<<endl;
      cout<<solve2()<<endl;
    }
  }
}
