#include <bits/stdc++.h>
using namespace std;
const long long maxn = (long long)1e6 + 5;
long long MOD = (long long)1e9 + 7;
inline long long qpow(long long a, long long b) {
  return b ? ((b & 1) ? a * qpow(a * a % MOD, b >> 1) % MOD
                      : qpow(a * a % MOD, b >> 1)) %
                 MOD
           : 1;
}
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  map<pair<long long, long long>, long long> mp;
  long long flag = 0;
  for (long long i = (long long)(1); i <= (long long)(n); i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      flag++;
      continue;
    }
    long long g = gcd(a, b);
    a /= g, b /= g;
    if (a < 0) a = -a, b = -b;
    mp[{a, b}]++;
  }
  long long ans = 1;
  for (auto p : mp) {
    auto cur = p.first;
    long long cnt1 = p.second;
    long long cnt2 =
        mp.count({cur.second, -cur.first}) ? mp[{cur.second, -cur.first}] : 0;
    if (cur.second < 0) {
      if (!mp.count({-cur.second, cur.first}))
        ans *= (qpow(2, cnt1) + MOD) % MOD;
    } else
      ans *= (qpow(2, cnt1) + qpow(2, cnt2) - 1 + MOD) % MOD;
    ans %= MOD;
  }
  ans += flag - 1;
  cout << ans << endl;
}
