#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n) ; i++)
#define rrep(i,n) for(int i = n-1; i >= 0 ; i--)
typedef long long ll;
constexpr auto INFI = 2147483647;
const ll INFL = 9223372036854775807;

int main(){
  map<pair<ll,ll>, pair<ll,ll>> fish_var;
  ll n , a, b, gcd_ab, tmp_a;
  ll zero = 0;
  pair<ll,ll> fish_vec;
  cin >> n;
  rep(i,n){
    bool isInv = false;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
      continue;
    } else if (a == 0) {
      a = 1;
      b = 0;
      isInv = true;
    } else if (b == 0) {
      a = 1;
    } else {
      gcd_ab = __gcd(a, b);
      a /= gcd_ab;
      b /= gcd_ab;
      if (a < 0 && b < 0) {
        a *= -1;
        b *= -1;
      } else if (a < 0){
        isInv = true;
        tmp_a = -1 * a;
        a = b;
        b = tmp_a;
      } else if (b < 0){
        isInv = true;
        tmp_a = a;
        a = -1 * b;
        b = tmp_a;
      }
    }
    fish_vec = make_pair(a,b);
    if (isInv){
      fish_var[fish_vec].second++;
    } else{
      fish_var[fish_vec].first++;
    }
  }
  ll ans = 1;
  ll mod = 1000000007;
  for (const auto& [key,value] : fish_var) {
    ll now = 1;
    now += ((ll)(pow(2,value.first)) - 1) % mod;
    now += ((ll)(pow(2,value.second)) - 1) % mod;
    ans = (ans * now) % mod;
  }
  ans =  (ans + zero - 1) % mod;
  cout << ans << endl;
}