#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
pair<long long, long long> normalize(pair<long long, long long> u) {
  long long x = u.first, y = u.second;
  if (x == 0)
    return {0, 1};
  else if (y == 0)
    return {1, 0};
  long long d = gcd(x, y);
  if (d < 0) d *= -1;
  x /= d;
  y /= d;
  if (y < 0) {
    x *= -1;
    y *= -1;
  }
  return {x, y};
}
pair<long long, long long> ortho(pair<long long, long long> u) {
  return {-u.second, u.first};
}
long long mod_pow(long long base, long long exp) {
  if (exp == 0) return 1;
  if (exp & 1)
    return (base * mod_pow(base, exp - 1)) % MOD;
  else
    return mod_pow((base * base) % MOD, exp >> 1);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  map<pair<long long, long long>, long long> slopes;
  for (int i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    slopes[normalize({x, y})]++;
    slopes[normalize(ortho({x, y}))] += 0;
  }
  set<pair<long long, long long>> done;
  long long ans = 1;
  for (const auto& p : slopes) {
    pair<long long, long long> u = p.first;
    pair<long long, long long> v = normalize(ortho(u));
    if (!done.count(u) && !done.count(v)) {
      ans = (ans * (mod_pow(2, slopes[u]) + mod_pow(2, slopes[v]) - 1)) % MOD;
      done.insert(u);
      done.insert(v);
    }
  }
  ans = ((ans - 1) % MOD + MOD) % MOD;
  cout << ans << '\n';
  cout << flush;
  return 0;
}
