#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define FPEN2 freopen("out.txt", "w", stdout);
#else
#define FPEN
#define FPEN2
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 1e9 + 7;
class {
 public:
  i64 A[maxn], B[maxn];
  map<pair<i64, i64>, int> mp;
  i64 pw2[maxn];
  void solve() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> A[i] >> B[i];
    pw2[0] = 1;
    for (int i = 1; i < maxn; ++i) pw2[i] = pw2[i - 1] * 2 % MOD;
    int A0 = 0, B0 = 0;
    i64 add = 0 for (int i = 1; i <= n; ++i) {
      if (A[i] == 0 && B[i] == 0) {
        add++;
        continue;
      }
      if (A[i] == 0)
        A0++;
      else if (B[i] == 0)
        B0++;
      else {
        int f = -1;
        if (A[i] > 0 && B[i] > 0)
          f = 1;
        else if (A[i] < 0 && B[i] < 0)
          f = 1;
        A[i] = abs(A[i]);
        B[i] = abs(B[i]);
        i64 gcd = __gcd(A[i], B[i]);
        A[i] /= gcd, B[i] /= gcd;
        mp[{A[i] * f, B[i]}]++;
      }
    }
    i64 ans = 1;
    for (auto i : mp) {
      if (i.second == 0) continue;
      pi64 j;
      if (i.first.first < 0)
        j = {i.first.second, -i.first.first};
      else
        j = {-i.first.second, i.first.first};
      // cout << i.first.first << " " << i.first.second << " " << j.first << " " << j.second << endl;
      if (mp.count(j)) {
        (ans *= (pw2[i.second] + pw2[mp[j]] + MOD - 1) % MOD) %= MOD;
        mp[j] = 0;
      } else {
        (ans *= pw2[i.second]) %= MOD;
      }
    }
    if (A0 == 0 && B0) {
      (ans *= pw2[B0]) %= MOD;
    } else if (A0 && !B0) {
      (ans *= pw2[A0]) %= MOD;
    } else if (A0 && B0) {
      (ans *= (pw2[A0] + pw2[B0] + MOD - 1) % MOD) %= MOD;
    }
    ans += add - 1;
    ans = (ans % MOD + MOD) % MOD;
    cout << ans << '\n';
  }
} NSPACE;
int main() {
  FPEN;
  FPEN2;
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  NSPACE.solve();
}