#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 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);
  }
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
signed main() {
  int n;
  cin >> n;
  map<pair<long long int, long long int>, pair<long long int, long long int> >
      m;
  long long int zero = 0LL;
  for (int i = 0; i < (int)(n); i++) {
    long long int a, b;
    cin >> a >> b;
    long long int g = gcd(a, b);
    if (a == 0 && b == 0) {
      zero++;
      continue;
    } else if (a == 0) {
      b = 1;
      m[make_pair(a, b)].first++;
    } else if (b == 0) {
      a = 1;
      m[make_pair(b, a)].second++;
    } else {
      a /= g;
      b /= g;
      if (a * b > 0)
        a = abs(a), b = abs(b);
      else
        a = abs(a), b = -abs(b);
      if (b > 0) {
        m[make_pair(a, b)].first++;
        cerr << a << " " << b << endl;
      } else {
        m[make_pair(-b, a)].second++;
        cerr << a << " " << b << endl;
      }
    }
  }
  long long int ans = 1LL;
  for (auto itr = m.begin(); itr != m.end(); ++itr) {
    long long int cnt1 = itr->second.first;
    long long int cnt2 = itr->second.second;
    long long int tmp = 0LL;
    tmp += mpow(2, cnt1);
    tmp += mpow(2, cnt2);
    tmp %= (long long int)(1e9 + 7);
    ans *= tmp - 1;
    ans %= (long long int)(1e9 + 7);
  }
  cout << ans - 1 + zero << endl;
  return 0;
}
