#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vst = vector<st>;
using vch = vector<char>;
using vbl = vector<bl>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b;return true;} return false;}
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b;return true;} return false;}
const ll mod = 1000000007;
const ll inf = 1LL << 60;
const db pi = acos(-1.0L);

ll modpow(ll a, ll n){
  ll ans = 1;
  while(n > 0){
    if(n & 1) ans = ans * a % mod;
    n >>= 1;
    a = a * a % mod;
  }
  return ans;
}

ll gcd(ll a, ll b){
	if(b == 0) return a;
	else return gcd(b, a % b);
}

int main(){
	ll n;
	cin >> n;
	ll all0 = 0;
	map<pll, ll> slope;
	rep(i, 0, n){
		ll a, b;
		cin >> a >> b;
		if(a == 0 && b == 0){
			all0++;
		}
		else if(a == 0) slope[make_pair(0, 1)]++;
		else if(b == 0) slope[make_pair(1, 0)]++;
		else if{
			ll aa = ((a > 0) - (a < 0)) * ((b > 0) - (b < 0)) * abs(a) / gcd(abs(a), abs(b));
			ll bb = abs(b) / gcd(abs(a), abs(b));
			slope[make_pair(aa, bb)]++;
		}
	}

	ll ans = 1;
	vrep(i, slope){
		ll a = i.first.first, b = i.first.second, kind1 = i.second, kind2 = 0;
		if(a == 0 && slope.count(make_pair(1, 0))){
			kind2 = slope[make_pair(1, 0)];
			slope.erase(make_pair(1, 0));
		}
		else if(b == 0 && slope.count(make_pair(0, 1))){
			kind2 = slope[make_pair(0, 1)];
			slope.erase(make_pair(0, 1));
		}
		else if (slope.count(make_pair(((a < 0) - (a > 0)) * b, abs(a)))){
			kind2 = slope[make_pair(((a < 0) - (a > 0)) * b, abs(a))];
			slope.erase(make_pair(((a < 0) - (a > 0)) * b, abs(a)));
		}
		ans = ans * (modpow(2, kind1) + modpow(2, kind2) - 1) % mod;
	}
	ans = ans + all0 - 1;
	cout << ans << endl;
}