#include"bits/stdc++.h"
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }

lint N, A, B;
map<plint, lint> p_cnt;
map<plint, lint> m_cnt;
const lint MOD = 1000000007;

template <std::int_fast64_t Modulus>
class modint
{
	using u64 = std::int_fast64_t;

public:
	u64 a;
	constexpr modint(const u64 x = 0) noexcept : a(x% Modulus) {}
	constexpr u64& value() noexcept { return a; }
	constexpr const u64& value() const noexcept { return a; }
	constexpr modint operator+(const modint rhs) const noexcept
	{
		return modint(*this) += rhs;
	}
	constexpr modint operator-(const modint rhs) const noexcept
	{
		return modint(*this) -= rhs;
	}
	constexpr modint operator*(const modint rhs) const noexcept
	{
		return modint(*this) *= rhs;
	}
	constexpr modint operator/(const modint rhs) const noexcept
	{
		return modint(*this) /= rhs;
	}
	constexpr modint& operator+=(const modint rhs) noexcept
	{
		a += rhs.a;
		if (a >= Modulus)
		{
			a -= Modulus;
		}
		return *this;
	}
	constexpr modint& operator-=(const modint rhs) noexcept
	{
		if (a < rhs.a)
		{
			a += Modulus;
		}
		a -= rhs.a;
		return *this;
	}
	constexpr modint& operator*=(const modint rhs) noexcept
	{
		a = a * rhs.a % Modulus;
		return *this;
	}
	constexpr modint& operator/=(modint rhs) noexcept
	{
		u64 exp = Modulus - 2;
		while (exp)
		{
			if (exp % 2)
			{
				*this *= rhs;
			}
			rhs *= rhs;
			exp /= 2;
		}
		return *this;
	}
};
typedef modint<MOD> ModInt;
#pragma endregion
	
ModInt mod_pow(ModInt x, ModInt n) {
	ModInt ret = 1;
	while (n.a > 0) {
		if (n.a & 1) (ret *= x);
		(x *= x);
		n.a >>= 1;
	}
	return ret;
}

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

vector<plint> pa;
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N;
	lint cnt = 0, zero_cnt = 0;
	REP(i, N) {
		cin >> A >> B;
		if (A == 0 && B != 0) {
			m_cnt[plint(0, 1)]++;
			continue;
		}
		else if (A != 0 && B == 0) {
			p_cnt[plint(1, 0)]++;
			continue;
		}
		else if (A == 0 && B == 0) {
			cnt++;
			zero_cnt++;
			continue;
		}
		if ((A < 0) ^ (B < 0)) {
			if (A < 0) A *= -1;
			if (B < 0) B *= -1;
			lint _gcd = gcd(A, B);
			m_cnt[plint(A/_gcd, B/_gcd)]++;
		}
		else {
			if (A < 0) A *= -1;
			if (B < 0) B *= -1;
			lint _gcd = gcd(A, B);
			p_cnt[plint(A/_gcd, B/_gcd)]++;
		}
	}
	for (auto itr : m_cnt) {
		plint opp = plint(itr.first.second, itr.first.first);
		if (p_cnt.find(opp) != p_cnt.end()) {
			cnt += p_cnt[opp];
			pa.push_back(plint(itr.second, p_cnt[opp]));
		}
	}
	for (auto itr : p_cnt) {
		plint opp = plint(itr.first.second, itr.first.first);
		if (m_cnt.find(opp) != m_cnt.end()) {
			cnt += m_cnt[opp];
		}
	}
	ModInt ans;
	ans = mod_pow(2, N - cnt);
	REP(i, SZ(pa)) {
		ans *= (mod_pow(2, pa[i].first) + mod_pow(2, pa[i].second) - 1);	
	}
	if (ans.a + zero_cnt == 0) {
		cout << ans.a + MOD - 1;
	}
	else {
		cout << (ans.a - 1 + zero_cnt);
	}
}


Measured memory_bytes: 16044