#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-32
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=200005;
//i_am_noob
int n,k,pt1,pt2,ans=1,x;
pii a[maxn];
ld b[maxn];
vector<int> vec1,vec2,vec3,vec4;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	rep(n) cin >> a[i].first >> a[i].second;
	rep(n) b[i]=a[i].first==0?(ld)2e18:(ld)a[i].second/a[i].first;
	sort(b,b+n);
	rep(n) if(b[i]>eps){
		k=i;
		break;
	}
	if(k==0){
		print1(Pow(2,n)-1);
		return 0;
	}
	vec1.pb(0),vec2.pb(k);
	rep2(i,1,k) if(abs(b[i]-b[i-1])>eps) vec1.pb(i);
	rep2(i,k+1,n) if(abs(b[i]-b[i-1])>eps) vec2.pb(i);
	pt1=0,pt2=0;
	while(pt1<sz(vec1)&&pt2<sz(vec2)){
		if(abs(b[vec1[pt1]]+1/b[vec2[pt2]])<eps){
			vec3.pb((pt1==sz(vec1)-1?k:vec1[pt1+1])-vec1[pt1]);
			vec4.pb((pt2==sz(vec2)-1?n:vec2[pt2+1])-vec2[pt2]);
			pt1++,pt2++;
		}
		else if(b[vec1[pt1]]+1/b[vec2[pt2]]<-eps) pt1++;
		else pt2++;
	}
	x=n;
	rep(sz(vec3)){
		x-=vec3[i],x-=vec4[i];
		ans=ans*(add(Pow(2,vec3[i])-1,Pow(2,vec4[i])))%MOD;
	}
	ans=ans*(Pow(2,x))%MOD;
	print1(sub(ans,1));
	return 0;
}