#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define pll pair<ll,ll>
#define pb push_back
#define F first
#define S second
#define I insert
#define vll vector<ll>
#define vbl vector<bool>
#define vvll vector<vll>
#define vld vector<ld>
#define vb vector<bool>
#define vc vector<char>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()

template<class T> ostream& operator<<(ostream &os, vector<T> V){
	os << "[ ";
	for(auto v  : V) os << v << " ";
	return os << " ]";
}
template<class T> ostream& operator<<(ostream &os, set<T> V){
	os << "[ ";
	for(auto v  : V) os << v << " ";
	return os << " ]";
}
template<class T , class R > ostream& operator<<(ostream &os, map<T , R> V){
	os << "[ ";
	for(auto v  : V) os << "(" << v.first << ":" << v.second << ")";
	return os << " ]";
}
template<class T , class R > ostream& operator<<(ostream &os, pair<T , R> V){
	return os << "(" << V.first << "," << V.second << ")";
}

#define cerr cout
#define TRACE
#ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1<<" | ";
        __f(comma+1, args...);
    }
    clock_t clk=clock();
    #define checktime() cout<<"\nTime Elapsed : "<<float(clock()-clk)/CLOCKS_PER_SEC<<endl
#else
    #define trace(...);
    #define checktime();
#endif

const ll Mod = 1e9 + 7;
// const ll Mod = 998244353;
const ll MAXN = 1e6;

ll modexp(ll x, ll n) 
{ 
	if (n == 0) { 
		return 1; 
	} 
	else if (n % 2 == 0) { 
		return modexp((x * x) % Mod, n / 2); 
	} 
	else { 
		return (x * modexp((x * x) % Mod, (n - 1) / 2) % Mod); 
	} 
}
ll getFractionModulo(ll a, ll b) 
{ 
	ll c = __gcd(a, b); 

	a = a / c; 
	b = b / c; 

	// (b ^ m-2) % m 
	ll d = modexp(b, Mod - 2); 

	// Final answer 
	ll ans = ((a % Mod) * (d % Mod)) % Mod; 

	return ans; 
}

void solve(){
    ll n;cin>>n;
    map<ld,ll> mp;
    vpll v(n);
    ll a0=0,b0=0,ab0=0;
    for(ll i=0;i<n;i++){
        ll a,b;cin>>a>>b;
        v[i]={a,b};
        if(a==0&&b==0) ab0++;
        else if(a==0) a0++;
        else if(b==0) b0++;
        else mp[a*1.0/b]++;
    }
    map<ld,bool> vis;
    ll ans=1;
    for(ll i=0;i<n;i++){
        if(v[i].F!=0&&v[i].S!=0&&!vis[v[i].S*-1.0/v[i].F]&&!vis[v[i].F*1.0/v[i].S]){
            ll x=mp[v[i].F*1.0/v[i].S], y=mp[v[i].S*-1.0/v[i].F];
            // trace(v[i],x,y);
            ans=(ans*((modexp(2,x)+modexp(2,y)-1))%Mod)%Mod;
            vis[v[i].F*1.0/v[i].S]=1;
            vis[v[i].S*-1.0/v[i].F]=1;
        }
    }
    ans=(ans*((modexp(2,a0)+modexp(2,b0)-1))%Mod)%Mod;
    ans=(ans+ab0)%Mod;
    cout<<ans-1<<"\n";
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<fixed<<setprecision(25);

    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}