#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <stack>
#include <algorithm>
#include <climits>
#include <cmath>
#include <functional>
#include <utility>
#include <numeric>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  int n;
  cin >> n;
  // vector<pair<ll, ll>> a(n);
  vecll p2(n + 1, 1LL);
  REP(i, n) {
    p2[i + 1] = p2[i] * 2LL;
    p2[i + 1] %= MOD;
  }
  map<pair<ll, ll>, ll> mp;
  ll cnt = 0;
  REP(i, n) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      cnt++;
      continue;
    }
    ll g = gcd(abs(a), abs(b));
    a /= g;
    b /= g;
    if (a == 0 && b != 0) {
      //(0,1)
      b = 1;
    } else if (b == 0 && a != 0) {
      //(1,0)
      a = 1;
    }
    if ((a < 0 && b > 0) || (a < 0 && b < 0)) {
      // (+a,-b) or (+a, +b)
      a *= -1LL;
      b *= -1LL;
    }
    mp[{a, b}]++;
  }
  ll ans = 1LL;
  map<pair<ll, ll>, int> seen;
  REPvec(itr, mp) {
    pair<ll, ll> p = itr->first;
    if (seen[p] > 0) continue;
    seen[p] = 1;
    pair<ll, ll> q = {abs(p.second), -abs(p.first)};
    if (p == q || mp.count(q) == 0) {
      // cout << "(" << p.first << "," << p.second << "), " << (ll)p2[mp[p]]
          //  << endl;
      ans *= (ll)p2[mp[p]];
      ans %= MOD;
    } else {
      seen[q] = 1;
      // cout << "(" << p.first << "," << p.second << "), (" << q.first << ","
      //      << q.second << ")" << endl;
      // cout << (p2[mp[p]] + p2[mp[q]] - 1LL) % MOD << endl;
      ans *= ((p2[mp[p]] + p2[mp[q]] + MOD) - 1LL) % MOD;
      ans %= MOD;
    }
    // cout << ans << endl;
  }
  ans += cnt;
  ans = ((ans + MOD) - 1LL) % MOD;
  cout << ans << endl;
}
