#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

const int MOD = 1e9 + 7;

int sub(int a, int b) {
	return (a - b + MOD) % MOD;
}

int add(int a, int b) {
	return (a + b) % MOD;
} 

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

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);	

	int n;
	cin >> n;
	vector<int> pw(n + 1);
	pw[0] = 1;
	for (int i = 0; i < n; i++) {
		pw[i + 1] = mul(2, pw[i]);
	}
	map<pair<pair<int, int>, int>, int> cnt;
	int ans = 1;
	int kek = 0;
	while (n--) {
		int x, y;
		cin >> x >> y;
		if (x == 0 && y == 0) {
			kek++;
			continue;
		}
		int g = gcd(abs(x), abs(y));
		x /= g;
		y /= g;
		int c = 0;
		for (int i = 0; i < 4; i++) {
			if (y >= 0 && x > 0) {
				// cerr << x << ' ' << y << ' ' << c % 2 << endl;
				cnt[{{x, y}, c % 2}]++;
				break;
			}
			int nx = -y;
			int ny = x;
			x = nx;
			y = ny;
			c++;
		}
	}
	for (auto [f, s] : cnt) {
		if (!cnt.count({f.first, f.second ^ 1})) {
			ans = mul(ans, s + 1);
			// cerr << s + 1 << endl;
		} else {
			if (f.second == 1) continue;
			int cur = pw[cnt[{f.first, f.second ^ 1}]];
			cur = add(cur, pw[s]);
			cur = sub(cur, 1);
			// cerr << cur << endl;
			ans = mul(ans, cur);
		}
	}
	ans = sub(ans, 1);
	ans = add(ans, kek);
	cout << ans << endl;
}