// E - ∙ (Bullet)

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

// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct ModInt {
	long long val;
	constexpr ModInt(long long v = 0) noexcept : val(v % MOD) {
		if (val < 0) val += MOD;
	}
	constexpr int getmod() { return MOD; }
	constexpr ModInt operator - () const noexcept {
		return val ? MOD - val : 0;
	}
	constexpr ModInt operator + (const ModInt& r) const noexcept { return ModInt(*this) += r; }
	constexpr ModInt operator - (const ModInt& r) const noexcept { return ModInt(*this) -= r; }
	constexpr ModInt operator * (const ModInt& r) const noexcept { return ModInt(*this) *= r; }
	constexpr ModInt operator / (const ModInt& r) const noexcept { return ModInt(*this) /= r; }
	constexpr ModInt& operator += (const ModInt& r) noexcept {
		val += r.val;
		if (val >= MOD) val -= MOD;
		return *this;
	}
	constexpr ModInt& operator -= (const ModInt& r) noexcept {
		val -= r.val;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr ModInt& operator *= (const ModInt& r) noexcept {
		val = val * r.val % MOD;
		return *this;
	}
	constexpr ModInt& operator /= (const ModInt& r) noexcept {
		long long a = r.val, b = MOD, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % MOD;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr bool operator == (const ModInt& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const ModInt& r) const noexcept {
		return this->val != r.val;
	}
	friend constexpr ostream& operator << (ostream &os, const ModInt<MOD>& x) noexcept {
		return os << x.val;
	}
	friend constexpr ModInt<MOD> modpow(const ModInt<MOD> &a, long long n) noexcept {
		if (n == 0) return 1;
		auto t = modpow(a, n / 2);
		t = t * t;
		if (n & 1) t = t * a;
		return t;
	}
};

const int MOD = 1000000007;
using mint = ModInt<MOD>;

ll A[200000];
ll B[200000];
map<pair<ll, ll>, int> cnt;

// 正規化 A/Bが既約分数になるように正規化
// A = B = 0 の時は (0, 0)
// A = 0, B != 0 の時は (0, 1)
// A != 0, B = 0 の時は (1, 0)
pair<ll, ll> normalize(ll a, ll b) {
	if (a == 0 && b == 0) return make_pair(0, 0);
	if (a == 0 && b != 0) return make_pair(0, 1);
	if (a != 0 && b == 0) return make_pair(1, 0);

	ll gcd = __gcd(a, b);

	ll sign;
	if ((a > 0 && b < 0) || (a < 0 && b > 0)) sign = -1;
	else sign = 1;

	return make_pair(sign * abs(a / gcd), abs(b / gcd));
}

int main() {
	int N;
	cin >> N;

	for (int i=0; i<N; i++) {
		cin >> A[i] >> B[i];
	}

	for (int i=0; i<N; i++) {
		cnt[normalize(A[i], B[i])]++;
	}

	/*
	// **** debug ****
	for (auto itr = cnt.begin(); itr != cnt.end(); itr++) {
		pair<ll, ll> AB = itr->first;
		ll A = AB.first;
		ll B = AB.second;
		mint n = itr->second;
		cout << A << " " << B << " " << n << endl;
	}
	*/

	mint ans = 1;

	// ---- A = B = 0 以外をカウント ---- //
	set<pair<ll, ll>> done;
	for (auto itr = cnt.begin(); itr != cnt.end(); itr++) {
		pair<ll, ll> AB = itr->first;
		ll A = AB.first;
		ll B = AB.second;

		if (A == 0 && B == 0) continue;

		pair<ll, ll> nBA;
		if (A == 0 || B == 0) {
			nBA = make_pair(B, A);
		} else if (A > 0) {
			nBA = make_pair(-B, A);
		} else {
			nBA = make_pair(B, -A);
		}

		if (done.count(AB) > 0) continue;

		ans *= (modpow((mint)2, cnt[AB]) - 1) + (modpow((mint)2, cnt[nBA]) - 1) + 1;

		done.insert(nBA);
	}

	ans -= 1; // 一匹も選ばない場合を除く

	// ---- A = B = 0 をカウント ---- //
	ans += cnt[make_pair(0, 0)]; // 他のイワシは選べない

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 44148