#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
#define D(x) cerr << #x << " = " << (x) << '\n'
using ll = long long;

const int mod = 1e9 + 7;

ll fast(ll b, ll e) {
	ll ans = 1;
	for(; e; b = b * b % mod, e /= 2) 
		if(e&1) ans = ans * b % mod;
	return ans;
}

int add(int x, int y) {
	return (x + y) % mod;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n, ans = 1;
	cin >> n;
	map<pair<int, int>, pair<int, int> > m;
	for(int i = 0; i < n; ++ i) {
		int a, b;
		cin >> a >> b;
		if(a == 0 && b == 0) ans ++;
		else {
			int g = __gcd(a, b);
			a /= g, b /= g;
			if(a > 0) m[{a, b}].first++;
			else m[{b, -a}].second++;
		}
	}
	for(auto e:m) {
		int x, y;
		tie(x, y) = e.second;
		ans = ans * add(fast(2, x), fast(2, y) - 1) % mod;
	}
	cout << (ans - 1 + mod) % mod << '\n';
}
