#include <bits/stdc++.h>
using namespace std;

#define int ll

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define fs first
#define sd second

typedef long long ll;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

double get_time() {
	return 1.0 * clock() / CLOCKS_PER_SEC;
}

typedef long double ld;

const int MOD = 1E9 + 7;
const ld EPS = 1E-20;

int binpow(int base, int e) {
	int ret = 1;
	while(e) {
		if(e & 1)
			ret = (ret * base) % MOD;
		e >>= 1;
		base = base * base % MOD;
	}
	return ret;
}

int32_t main() {
	int n;
	cin >> n;
	int res = 1;
	map<pi, int> m;
	int cnt1 = 0, cnt2 = 0;
	for(int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		int g = __gcd(abs(a), abs(b));
		if(g) {
			a /= g;
			b /= g;
		}
		if(a == 0 && b != 0) {
			res = (res + binpow(2, cnt1)) % MOD;
			cnt1++;
		}
		else if(a != 0 && b == 0) {
			res = (res + binpow(2, cnt2)) % MOD;
			cnt2++;
		}
		else if(a == 0 && b == 0) {
			res = (res + 1) % MOD;
		}
		else {
			int cnt = m[{-b, a}] + m[{b, -a}];
			// debug(i, cnt, res);
			// int k = res / (cnt + 1);
			// //int k = res * binpow(cnt + 1, MOD - 2)  % MOD;
			// // debug(i, num, m[{-b, a]);
			// debug(i, a, b, m[{-b, a}], k);
			// res = (res + k) % MOD;
			// m[{a, b}]++;
			// // m[{-a, -b}]++;
			//debug(i, cnt);
			// assert(res % (cnt + 1) == 0);
			//debug(res, cnt + 1);
			res = (res + res * binpow(binpow(2, cnt), MOD - 2)) % MOD;
			m[{a, b}]++;
		}
	}
	cout << ((res - 1) % MOD + MOD) % MOD << '\n';
}

/*
3
1 1
1 -1
2 -2
*/
