#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) {
  if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
int main() {
  int n;
  ll mod = 1000000007;
  cin >> n;
  ll a, b, count = 0;
  map<ll, ll> iwashi;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    ll g = gcd(a, b);
    a /= g;
    b /= g;
    if (a == 0 && b == 0)
      count++;
    else if (a == 0 && b != 0)
      b = 1;
    else if (a != 0 && b == 0)
      a = 1;
    else if (a < 0) {
      a *= -1;
      b *= -1;
    }
    iwashi[a / b]++;
  }
  ll p, q;
  for (ll v = 0; v < LLONG_MAX; v++) {
    p = iwashi[v], q = iwashi[-v];
    count += pow(2, p) + pow(2, q) - 1;
    count %= mod;
  }
  count--;
  cout << count << endl;
}
