#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int maxn = 2e5+10;
const int mod = 1000000007;
LL GCD(LL a, LL b) return a == 0 ? b : GCD(b%a,a);
LL a[maxn], b[maxn];
int id[maxn];
bool cmp(int p, int q){
	return b[p] == b[q] ? a[p] < a[q]: b[p] < b[q];
}
int main(){
  	int n;
  	LL x,y,gcd;
  	for (int i=1;i<=n;i++){
      	cin>>x>>y;
      	if (x == 0 || y == 0) {a[i] = x; b[i] = y; continue;}
      	gcd = GCD(x,y);
      	if (x > 0 && y > 0) {a[i] = x / gcd; b[i] = y / gcd; continue;}
      	if (x < 0 && y < 0) {a[i] = -x / gcd; b[i] = -y / gcd; continue;}
      	if (x > 0 && y < 0) {a[i] = -y / gcd; b[i] = x / gcd; continue;}
        if (x < 0 && y > 0) {a[i] = y / gcd; b[i] = -x / gcd; continue;}
    	id[i] = i;
    }
  	sort(id+1,id+1+n,cmp);
  	int zero = 0, now = 0;
  	LL ans = 1;
  	for (int i=1;i<=n;i++){
    	if (a[i] == 0 && b[i] == 0 ){ zero++; continue; }
      	if (a[i] == a[i-1] && b[i] = b[i-1]) now++;
        else {
          	ans = ( ans * (now + 1) ) % mod;
        	now = 1;
        }
    }
  	ans = (ans * (now + 1) ) % mod;
  	ans += zero;
  	ans += mod - 1;
  	ans %= mod;
  	cout<<ans<<endl;
	return 0;
}
