#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define all(x) x.begin(),x.end()
#define FIO ios_base::sync_with_stdio(false), cin.tie(NULL);
#define N 200005
const int mod = 1000000007;
map<pair<ll,ll>,pair<int,int>> mp;
int n;
ll a[N], b[N];
ll p2[N];
int main(){
	FIO;
    p2[0] = 1;
    for(int i = 1 ; i < N ; i++) p2[i] = (p2[i-1]*2) % mod;
    cin >> n;
    for(int i = 0 ; i < n ; i++) cin >> a[i] >> b[i];
    for(int i = 0 ; i < n ; i++){
        ll g = __gcd(a[i],b[i]);
        if((a[i] > 0 && b[i] < 0) || (a[i] < 0 && b[i] > 0)){
            mp[{abs(b[i]/g),abs(a[i]/g)}].second++;
        }else{
            mp[{abs(a[i]/g),abs(b[i]/g)}].first++;
        }
    }
    ll ans = 1;
    for(auto v : mp){
        ans = (ans * (( p2[v.second.first] + p2[v.second.second] - 1)%mod) )%mod;
    }
    cout << ((ans-1)%mod+mod)%mod << endl;
	return 0;
}