#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
const int MAXN = 1e5 +5;
const LL mm = 1e9 + 7;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

LL po(LL a, LL b){
	if(b==0) return 1;
	LL an =po(a,b/2);
	an = (an*an)%mm;
	if(b&1) an = (an*a)%mm;
	return an;
}

int main(){
  fio();
  int n; cin>>n;
  map <pair<LL,LL>, LL> m;
  map <pair<LL,LL>, int> vis;
  forn(i,n){
  	LL a, b; cin>>a>>b;
  	LL x = gcd(a,b);
  	a/=x, b/=x;
  	if(b<0){
  		b*=-1;
  		a*=-1;
  	}
  	m[{a,b}]++;
  } 
  LL an = 1;
  for(auto i:m){
  	 if(vis[i.fi]) continue;
     pair<int,int> zx = {-1*i.fi.se,i.fi.fi};
     if(zx.se<0){
       zx.fi*=-1;
       zx.se*=-1;
     }
 	 LL z = ((po(2,i.se)-1) + (po(2,m[zx]) - 1) + 1 + mm)%mm; 
 	// cout<<z<<"--"<<endl;
     z = (z+mm)%mm;
 	 an = (an*z)%mm;
 	 vis[zx] = 1;
 	 vis[i.fi] = 1;
  }
  cout<<(an-1+mm)%mm<<endl;
  return 0;
}