#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > vv;
set<long double> v;
map<long double, long long> mp;
int main() {
  int n;
  cin >> n;
  int a0 = 0;
  for (int i = 0; i < n; i++) {
    long double x, y;
    cin >> x >> y;
    if (y == 0) {
      a0++;
      continue;
    }
    long double z = x / y;
    if (v.find(z) != v.end())
      mp[z]++;
    else {
      mp[z] = 1;
      v.insert(z);
    }
  }
  long long ans = 1;
  auto j = v.begin();
  for (int i = 0; i < v.size(); i++) {
    long double t = *j;
    if (t == 0) {
      if (a0) {
        int y1 = 1, y2 = 1;
        for (int k = 0; k < mp[0]; k++) y1 = y1 * 2 % 1000000007;
        for (int k = 0; k < a0; k++) y2 = y2 * 2 % 1000000007;
        long long yy = y1 + y2 - 1;
        ans = ans * yy % 1000000007;
        mp[0] = 0;
      }
      continue;
    }
    if (v.find(-(1 / t)) != v.end()) {
      int y1 = 1, y2 = 1;
      for (int k = 0; k < mp[t]; k++) y1 = y1 * 2 % 1000000007;
      for (int k = 0; k < mp[-(1 / t)]; k++) y2 = y2 * 2 % 1000000007;
      long long yy = y1 + y2 - 1;
      ans = ans * yy % 1000000007;
      mp[t] = 0;
      mp[-(1 / t)] = 0;
    }
    j++;
  }
  auto i = mp.begin();
  for (int k = 0; k < mp.size(); k++) {
    long long xx = 1;
    for (int k = 0; k < i->second; k++) xx = xx * 2 % 1000000007;
    ans = ans * xx % 1000000007;
    i++;
  }
  if (ans == 0) ans += 1000000007;
  cout << ans - 1;
  return 0;
}
