#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
const int ARRAY = 100005;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
const int MOD = 1000000007;
ll N = 0;
ll ret = 1;
map<ll, map<ll, map<ll, ll>>> table;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll modPow(ll x, ll y) {
  if (y == 0) return 1;
  if (y == 1) return x;
  if (y % 2 == 0)
    return modPow((x * x) % MOD, y / 2);
  else
    return (x * modPow((x * x) % MOD, y / 2)) % MOD;
}
int main(void) {
  ll n00 = 0;
  ll n01 = 0;
  ll n10 = 0;
  cin >> N;
  ;
  for (int i = 0; i < (N); i++) {
    ll A, B, sign = 1;
    cin >> A;
    ;
    cin >> B;
    ;
    if (A < 0) {
      sign *= -1;
      A = -A;
    }
    if (B < 0) {
      sign *= -1;
      B = -B;
    }
    if (A == 0 && B == 0) {
      n00++;
    } else if (A == 0) {
      n01++;
    } else if (B == 0) {
      n10++;
    } else {
      ll G = gcd(A, B);
      table[sign][A / G][B / G] += 1;
    }
  }
  ll rest = N - n00 - n01 - n10;
  for (auto itr1 = table.begin(); itr1 != table.end(); itr1++) {
    for (auto itr2 = itr1->second.begin(); itr2 != itr1->second.end(); itr2++) {
      for (auto itr3 = itr2->second.begin(); itr3 != itr2->second.end();
           itr3++) {
        if (table.count(-itr1->first) > 0) {
          if (table[-itr1->first].count(itr3->first) > 0) {
            if (table[-itr1->first][itr3->first].count(itr2->first) > 0) {
              ll a = itr3->second;
              ll b = table[-itr1->first][itr3->first][itr2->first];
              if (a * b > 0) {
                ret *= (modPow(2, a) + modPow(2, b) - 1) % MOD;
                ret %= MOD;
                rest -= a + b;
                itr3->second = 0;
                table[-itr1->first][itr3->first][itr2->first] = 0;
              }
            }
          }
        }
      }
    }
  }
  for (int i = 0; i < (rest); i++) {
    ret *= 2;
    ret %= MOD;
  }
  ret *= (modPow(2, n01) + modPow(2, n10) - 1);
  ret %= MOD;
  if (n00 > 0) ret += 1;
  ret -= 1;
  if (ret < 0) ret += MOD;
  ret %= MOD;
  cout << (ret) << endl;
  ;
}
