#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long pw(long long a, long long b) {
  if (!b) return 1;
  if (b % 2) return (pw(a, b - 1) * a) % mod;
  long long v = pw(a, b / 2);
  return (v * v) % mod;
}
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (!b) return a;
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
pair<long long, long long> get(long long a, long long b) {
  if (b == 0) {
    if (a < 0) return {-1, 0};
    return {1, 0};
  }
  if (b > 0) return {a / gcd(abs(a), abs(b)), b / gcd(abs(a), abs(b))};
  return {-a / gcd(abs(a), abs(b)), -b / gcd(abs(a), abs(b))};
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  map<pair<long long, long long>, long long> mp, rmp;
  long long ans = 1, cn = 0;
  for (int i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      cn++;
      continue;
    }
    pair<long long, long long> vp = get(a, b),
                               rvp = (a != 0 ? get(b, -a) : get(-b, a));
    if (mp.find(rvp) != mp.end())
      rmp[rvp]++;
    else
      mp[vp]++;
  }
  for (auto& i : mp) {
    long long vl = pw(2, i.second);
    if (rmp.find(i.first) != rmp.end()) vl += pw(2, rmp[i.first]) - 1;
    ans = (ans * vl) % mod;
  }
  cout << (ans + cn - 1) % mod;
}
