#include <bits/stdc++.h>
using namespace std;
const long long Mod = 1e9 + 7;
long long power(long long x, int y) {
  long long res = 1;
  x = x % Mod;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % Mod;
    y = y >> 1;
    x = (x * x) % Mod;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(5);
  int n;
  cin >> n;
  map<double, pair<int, int>> mp;
  for (int i = 0; i < n; i++) {
    double a, b;
    cin >> a >> b;
    double ang = a / b;
    double bad = -b / a;
    if (mp.find(bad) != mp.end()) {
      mp[bad].second++;
    } else {
      mp[ang].first++;
    }
  }
  long long ans = 1;
  vector<pair<int, int>> special;
  for (auto& p : mp) {
    if (p.second.second == 0) {
      ans = ans * power(2, p.second.first) % Mod;
    } else {
      long long c1 = power(2, p.second.first) - 1;
      long long c2 = power(2, p.second.second) - 1;
      ans = (ans * (c1 + c2 + 1)) % Mod;
    }
  }
  cout << ans - 1 << '\n';
}
