#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
const long long int LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI = acos(-1.0L);
__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
long long int cost(int i, int s, vector<long long int> &a) {
  if (s == 0 || s == 4)
    return a[i];
  else if (s == 1 || s == 3) {
    if (a[i] % 2 == 0 && a[i] > 0)
      return 0LL;
    else if (a[i] > 0)
      return 1LL;
    else
      return 2LL;
  } else {
    if (a[i] % 2LL == 0LL)
      return 1LL;
    else
      return 0LL;
  }
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long int mpow(long long int a, long long int b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0) {
    long long int memo = mpow(a, b / 2);
    return memo * memo % (long long int)(1e9 + 7);
  } else
    return mpow(a, b - 1) * a % (long long int)(1e9 + 7);
}
signed main() {
  long long int n;
  cin >> n;
  map<pair<long long int, long long int>, pair<long long int, long long int> >
      s;
  long long int zeros = 0LL;
  for (int i = 0; i < (int)(n); i++) {
    long long int a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      zeros++;
    else if (a == 0) {
      s[make_pair(0, 1)].first++;
    } else if (b == 0) {
      s[make_pair(0, 1)].second++;
    } else {
      long long int p = abs(a), q = abs(b);
      long long int g = gcd(p, q);
      a /= g;
      b /= g;
      if ((a > 0 && b > 0) || (a < 0 && b < 0)) {
        a = abs(a);
        b = abs(b);
        s[make_pair(a, b)].first++;
      } else {
        a = abs(a);
        b = abs(b);
        s[make_pair(b, a)].second++;
      }
    }
  }
  long long int ans = 1LL;
  for (auto e : s) {
    long long int p = mpow(2, e.second.first) + mpow(2, e.second.second) -
                      1LL % (long long int)(1e9 + 7);
    ans *= p;
    ans %= (long long int)(1e9 + 7);
  }
  cout << ans + zeros - 1 << endl;
  return 0;
}
