#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_pair tree<pair<int,int>,null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_mutiset tree<int,null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int,int> pi; 
#define PI 3.1415926535897932384
#define FOR(i,vv,n) for(int i=vv;i<n;i++)
#define FORR(i,n,vv) for(int i=n-1;i>=vv;i--)
#define ve vector 
#define maxind(v) (max_element(v.begin(),v.end())-v.begin())
#define minind(v) (min_element(v.begin(),v.end())-v.begin())
#define maxe(v) *max_element(v.begin(),v.end())
#define mine(v) *min_element(v.begin(),v.end())
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair
#define M 1000000007ll
#define M1 1000000000000000000ll
#define PRECISE cout.precision(18);
#define BS(v,n) binary_search(v.begin(),v.end(),n)
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.begin(),v.end(),greater <ll>())
#define F first
#define S second
#define GET(i,p) get<p>(i)

ll bexp(ll a,ll b,ll m){
ll ans=1;
ll d1=a%m;
while(b>0){
	if(b%2==0){
		d1=(d1*d1)%m;
		b/=2;
	}
	else{
		ans=(ans*d1)%m;
		b-=1;
	}
}
 
return ans;
 
}

pair <ll,ll> fun(ll x,ll y){
 	ll g=__gcd(x,y);
  	ll x1=x/g;
  	ll x2=y/g;
  	if(x2<0){
  		x1=-x1;
  		x2=-x2;
  	}
  	return make_pair(x1,x2);


}


int main(){

    FAST
//	PRECISE


  ll n;
  cin>>n;
  map <pair<ll,ll>,ll> m1;

  ve <pair <ll,ll> > v;
  ll c=0;
  FOR(i,0,n){
  	ll x,y;
  	cin>>x>>y;
  	v.pb({x,y});
 	pair <ll,ll> d=fun(x,y);
 	d.F=-d.F;
 	if(d!=make_pair(0ll,0ll))
  	m1[d]++;
  else
  	c++;
  }
ll z=1;
ll count=0;
while(!m1.empty()){
	ll c1=(m1.begin()->S);
	ll x=(m1.begin())->F.F;
	x=-x;
	ll y=(m1.begin())->F.S;
	m1.erase(m1.begin());
	pair <ll,ll> d=fun(y,x);
	ll c2=m1[d];
	z*=(bexp(2,c1,M)+bexp(2,c2,M)-1+M)%M;
	z=z%M;
	m1.erase(d);
}
cout<<(z+c-1)%M;

return 0;
 }







