#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long power_mod(long long base, long long exponent, long long mod) {
  long long result = 1;
  for (long long i = 0; i < exponent; i++) {
    result = (base * result) % mod;
  }
  return result;
}
pair<long long, long long> make_orthogonal(long long a1, long long b1) {
  long long a, b;
  if (b1 < 0) {
    a = -a1;
    b = -b1;
  } else {
    a = a1;
    b = b1;
  }
  if (a > 0) return (make_pair(-b, a));
  if (a == 0) return (make_pair(1, 0));
  if (a < 0) return (make_pair(b, -a));
  return (make_pair(0, 0));
}
int main() {
  int n;
  long long a, b;
  long long g;
  long long mod = 1000000007ULL;
  map<pair<long long, long long>, pair<int, int>> sardine_slopes;
  sardine_slopes.clear();
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    g = abs(gcd(a, b));
    a /= g;
    b /= g;
    if (b < 0) {
      a *= -1;
      b *= -1;
    }
    if (sardine_slopes[make_orthogonal(a, b)].first > 0) {
      sardine_slopes[make_orthogonal(a, b)].second++;
    } else {
      if (b == 0 && a != 0) {
        sardine_slopes[make_pair(1, 0)].first++;
      }
      if (b > 0) {
        sardine_slopes[make_pair(a, b)].first++;
      }
      if (b < 0) {
        sardine_slopes[make_pair(-a, -b)].first++;
      }
    }
  }
  long long result = 1, x, x1, x2;
  for (map<pair<long long, long long>, pair<int, int>>::iterator it =
           sardine_slopes.begin();
       it != sardine_slopes.end(); it++) {
    if (it->second.first > 0) {
      x1 = power_mod(2, (it->second.first), mod);
      x2 = power_mod(2, (it->second.second), mod);
      x = (x1 + x2 - 1) % mod;
      result = (result * x) % mod;
    }
  }
  result--;
  cout << result << endl;
  return 0;
}
