#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1000000007;
vector<int> Power2;
void initPower2(int n) {
  ll rtn = 1;
  for (int i = 0; i <= n; i++) {
    Power2.push_back(rtn);
    rtn *= 2;
    rtn %= MOD;
  }
}
ll gcd(ll c, ll d) {
  if (c < d) swap(c, d);
  while (c % d != 0) {
    c %= d;
    swap(c, d);
  }
  return d;
}
int main() {
  ll n;
  cin >> n;
  initPower2(n);
  ll c, d;
  int xy0 = 0;
  map<pair<ll, ll>, pair<int, int>> yuri;
  for (int i = 0; i < n; i++) {
    cin >> c >> d;
    if (!c && !d) {
      xy0++;
    } else if (!c) {
      yuri[{0, 1}].first++;
    } else if (!d) {
      yuri[{0, 1}].second++;
    } else if ((c / abs(c)) == (d / abs(d))) {
      ll g = gcd(abs(c), abs(d));
      yuri[{abs(c) / g, abs(d) / g}].first++;
    } else {
      ll g = gcd(abs(c), abs(d));
      yuri[{abs(d) / g, abs(c) / g}].second++;
    }
  }
  int ans = 1;
  for (auto p : yuri) {
    int yuriri = Power2[(int)p.second.first] - 1;
    yuriri += Power2[(int)p.second.second];
    yuriri %= MOD;
    ans *= yuriri;
    ans %= MOD;
  }
  ans = (ans - 1 + MOD - xy0) % MOD;
  cout << ans << endl;
}
