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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

const ll MOD = 1e9 + 7;

pll normalize(pll a) {
	ll x = a.xx, y = a.yy;
	ll g = __gcd(x,y);
	x /= g, y /= g;
	if (x < 0 || (x == 0 && y < 0)) x = -x, y = -y;
	return {x,y};
}

pll perp(pll a) {
	return normalize(make_pair(-a.yy,a.xx));
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll n; cin >> n;
	
	vl p2(n+1);
	p2[0] = 1;
	FOR(i,1,n+1) p2[i] = 2*p2[i-1] % MOD;
	
	map<pll,ll> cnt;
	while (n--) {
		pll p;
		cin >> p.xx >> p.yy;
		p = normalize(p);
		cnt[p]++;
		cnt[perp(p)] += 0;
	}

	pll zero(0,0);
	ll z = cnt[zero];
	cnt.erase(zero);

	ll res = 1;
	for (auto pr: cnt) {
		pll a = pr.xx, b = perp(a);
		ll c = pr.yy;
		
		if (a > b) continue;
		ll d = cnt[b];
		
		ll cur = (p2[c] + p2[d] - 1 + 3*MOD) % MOD;
		res = res*cur % MOD;
	}
	
	res = (res + z-1 + MOD) % MOD;
	cout << res << endl;
}

