#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
map<long double, pair<int, int>> mp;
int n;
int a[200005], b[200005];
long long p2[200005];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  ;
  p2[0] = 1;
  for (int i = 1; i < 200005; i++) p2[i] = (p2[i - 1] * 2) % mod;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  for (int i = 0; i < n; i++) {
    if ((a[i] > 0 && b[i] < 0) || (a[i] < 0 && b[i] > 0)) {
      mp[abs((long double)b[i] / a[i])].second++;
    } else {
      mp[abs((long double)a[i] / b[i])].first++;
    }
  }
  long long ans = 1;
  for (auto v : mp) {
    ans = (ans * (p2[v.second.first] + p2[v.second.second] - 1)) % mod;
  }
  cout << ((ans - 1) % mod + mod) % mod << endl;
  return 0;
}
