#ifdef MY_LOCAL
#define MY_MAIN(cls) class cls {public: int main();}; int cls::
#else
#define MY_MAIN(cls) int
#endif

#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

namespace {

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

ll modpow(ll base, ll exponent, ll mod)
{
	ll retval = 1;
	while (exponent > 0)
	{
		if (exponent % 2)
			retval = (retval * base) % mod;
		exponent /= 2;
		base = (base * base) % mod;
	}
	return retval;
}


MY_MAIN(sandbox) main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	ll modval = 1000000007;

	int n;
	cin >> n;
	map<pll, int> cnt;
	for (int i = 0; i < n; i++)
	{
		ll a, b;
		cin >> a >> b;
		if (a != 0 && b != 0)
		{
			if (a < 0)
			{
				a *= -1;
				b *= -1;
			}
			ll g = gcd(abs(a), abs(b));
			cnt[{a / g, b / g}]++;
		}
		else if (a == 0 && b == 0)
			cnt[{0, 0}]++;
		else if (a == 0)
			cnt[{0, 1}]++;
		else  // b == 0
			cnt[{1, 0}]++;
	}

	ll num00 = 1;
	if (cnt[{0, 0}] == 0)
		num00 = 0;
	else
		num00 = cnt[{0, 0}];
	cnt.erase(make_pair(0,0));

	ll num = 1;
	while (!cnt.empty())
	{
		auto this_item = *cnt.begin();
		cnt.erase(cnt.begin());
		pll this_pair = this_item.first;
		pll anti_pair = { this_pair.second, -this_pair.first };
		if (anti_pair.first < 0)
			anti_pair = { -this_pair.second, this_pair.first };
		else if (anti_pair.first == 0)
			anti_pair = { 0, 1 };
		if (cnt.find(anti_pair) == cnt.end())
			cnt[anti_pair] = 0;
		auto anti_item = cnt.find(anti_pair);

		num = num * (modpow(2, this_item.second, modval) - 1 + modpow(2, anti_item->second, modval) - 1 + 1) % modval;
		cnt.erase(anti_item);
	}
	ll retval = (num + modval - 1) % modval;
	cout << (retval + num00) % modval << "\n";
		
	return 0;
}

}