#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);
#define MOD 1000000007LL
#define endl "\n"

ll modbeki(ll x, ll n){
  ll res = 1LL;
  while(n > 0){
    if(n & 1){
      res *= x % MOD;
      res %= MOD;
    }
    x = x * x % MOD;
    n >>= 1;
  }
  return res % MOD;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  vll A(N), B(N);
  ll zero = 0;
  map<Pll, ll> mp;
  set<Pll> st;
  for(int i = 0; i < N; i++){
    cin >> A.at(i) >> B.at(i);
    if(A.at(i) == 0 && B.at(i) == 0){
      zero++;
      continue;
    }
    ll gg = __gcd(A.at(i), B.at(i));
    A.at(i) /= gg;
    B.at(i) /= gg;
    if(A.at(i) < 0 || (A.at(i) == 0 && B.at(i) < 0)){
      A.at(i) *= -1LL; B.at(i) *= -1LL;
    }
    mp[Pll(A.at(i), B.at(i))]++;
    st.insert(Pll(A.at(i), B.at(i)));
  }
  ll ans = 1LL;
  for(auto ite = st.begin(); ite != st.end(); ite++){
    Pll p = *ite;
    if(!mp.count(p)) continue;
    ll nn = mp.at(p);
    Pll q;
    if(p.second > 0) q = Pll(p.second, -p.first);
    else q = Pll(-p.second, p.first);
    ll mm = (mp.count(q)? mp.at(q): 0LL);
    if(mm != 0) ans *= (modbeki(2LL, nn) + modbeki(2LL, mm) - 1) % MOD;
    else ans *= modbeki(2LL, nn);
    ans %= MOD;
    mp.erase(p);
    if(mm != 0) mp.erase(q);
  }
  ans--;
  ans += zero;
  cout << ans << endl;
}