#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
const long long MOD = 1000000007;
long long powmod(long long x, long long n) {
  long long ret = 1;
  while (n > 0) {
    if (n & 1) {
      ret *= x;
      ret %= MOD;
      n -= 1;
    } else {
      x *= x;
      x %= MOD;
      n >>= 1;
    }
  }
  return ret;
}
long long gcd(long long a, long long b) {
  while (b != 0LL) {
    a %= b;
    if (a == 0LL) return b;
    b %= a;
  }
  return a;
}
signed main() {
  int n;
  cin >> n;
  map<pair<long long, long long>, long long> mp;
  int zero_zero = 0;
  int zero_x = 0, zero_y = 0;
  for (int i = 0; i < (n); i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero_zero++;
    } else if (a == 0) {
      zero_x++;
    } else if (b == 0) {
      zero_y++;
    } else {
      long long g = gcd(llabs(a), llabs(b));
      a /= g;
      b /= g;
      if (a < 0LL) {
        a *= (-1LL);
        b *= (-1LL);
      }
      mp[{a, b}]++;
    }
  }
  vector<long long> v;
  long long res = 1;
  res += powmod(2, zero_y) - 1;
  res %= MOD;
  res += powmod(2, zero_x) - 1;
  res %= MOD;
  v.push_back(res);
  map<pair<long long, long long>, bool> used;
  for (auto itr = mp.begin(); itr != mp.end(); itr++) {
    pair<long long, long long> p = itr->first;
    if (used[p]) continue;
    pair<long long, long long> p1;
    if (p.second > 0)
      p1 = {p.second, -p.first};
    else
      p1 = {-p.second, p.first};
    used[p] = 1;
    used[p1] = 1;
    long long x = mp[p], y = mp[p1];
    res = 1;
    res += powmod(2, y) - 1;
    res %= MOD;
    res += powmod(2, x) - 1;
    res %= MOD;
    v.push_back(res);
  }
  long long ans = 1;
  for (long long u : v) {
    ans *= u;
    ans %= MOD;
  }
  ans--;
  ans += zero_zero;
  cout << ans % MOD << endl;
  return 0;
}
