#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int MOD = 1000000007;

int mul(int a, int b)
{
	return (int) (1ll * a * b % MOD);
}

int add(int a, int b)
{
	int res = a + b;
	if (res >= MOD) res -= MOD;
	return res;
}

int sub(int a, int b)
{
	int res = a - b;
	if (res < 0) res += MOD;
	return res;
}

pair<ll, ll> norm(pair<ll, ll> p)
{
	pair<ll, ll> res = p;
	if (res.first == 0) {
		res.second = 1;
	} else if (res.second == 0) {
		res.first = 1;
	} else {
		ll gcd = __gcd(res.first, res.second);
		res.first /= gcd;
		res.second /= gcd;
		if (res.second < 0) {
			res.first = -res.first;
			res.second = -res.second;
		}
	}
	return res;
}

pair<ll, ll> rev(pair<ll, ll> p)
{
	return norm(make_pair(-p.second, p.first));
}

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

	int n;
	cin >> n;
	vector<int> p2(n);
	p2[0] = 1;
	for (int i = 1; i < n; i++) p2[i] = mul(2, p2[i - 1]);
	int z = 0;
	map<pair<ll, ll>, pair<ll, ll>> cn;
	for (int i = 0; i < n; i++) {
		pair<ll, ll> p;
		cin >> p.first >> p.second;
		if (p.first == 0 && p.second == 0) {
			z++;
			continue;
		}
		p = norm(p);
		cn[p].first++;
		cn[rev(p)].second++;
	}

	int res = 1;
	map<pair<ll, ll>, bool> skip;
	for (auto &p : cn) {
		if (skip[p.first]) continue;
		skip[rev(p.first)] = true;
		int all = sub(add(p2[p.second.first], p2[p.second.second]), 1);
		res = mul(res, all);
	}

	cout << add(sub(res, 1), z) << '\n';

	return 0;
}
