#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) {
  if (a > b) {
    return gcd(b, a);
  }
  if (b % a == 0) {
    return a;
  }
  return gcd(b % a, a);
}
struct Rat {
  ll sign, n, d;
  Rat(ll _n, ll _d) {
    if (_n == 0 || _d == 0) {
      sign = 0;
      n = 0;
      d = 0;
      return;
    }
    sign = 1;
    if (_n < 0) {
      sign = -sign;
      _n = -_n;
    }
    if (_d < 0) {
      sign = -sign;
      _d = -_d;
    }
    ll g = gcd(_n, _d);
    n = _n / g;
    d = _d / g;
  }
  bool operator<(const Rat& r) const {
    if (sign != r.sign) {
      return sign < r.sign;
    }
    if (n != r.n) {
      return n < r.n;
    }
    return d < r.d;
  }
};
map<Rat, int> s1;
map<Rat, int> s2;
Rat rev(const Rat& r) { return Rat(-r.d, r.n); }
bool eq(const Rat& a, const Rat& b) {
  return a.sign == b.sign && a.n == b.n && a.d == b.d;
}
ll two[200001];
void disp(const Rat& r) {
  cout << (r.sign < 0 ? "-" : "+") << r.n << "/" << r.d << endl;
}
int main() {
  const int kMod = 1000000007;
  two[0] = 1;
  for (int i = 1; i <= 200000; ++i) {
    two[i] = two[i - 1] * 2 % kMod;
  }
  int N;
  cin >> N;
  for (int i = 0; i < (int)(N); ++i) {
    ll A, B;
    cin >> A >> B;
    Rat r1(-B, A);
    s1[r1]++;
    Rat r2(A, B);
    s2[r2]++;
  }
  vector<pair<int, int>> groups;
  for (auto it : s2) {
    pair<int, int> p(it.second, s1[it.first]);
    if (p.second != 0 && it.first.sign < 0) continue;
    groups.push_back(make_pair(it.second, s1[it.first]));
  }
  long long mul = 1;
  for (auto p : groups) {
    ll m;
    if (p.second == 0) {
      m = two[p.first];
    } else {
      m = (two[p.first] + two[p.second] - 1) % kMod;
    }
    mul *= m;
    mul %= kMod;
  }
  cout << (mul - 1) << endl;
}
