#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int kai[200005];
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long mkai(int n) {
  if (n == 0) return kai[0] = 1;
  if (n % 2)
    return kai[n] = mkai(n / 2) * mkai(n / 2) * 2 % MOD;
  else
    return kai[n] = mkai(n / 2) * mkai(n / 2) % MOD;
}
int main() {
  int n;
  cin >> n;
  map<pair<long long, long long>, int> mp;
  long long mp00 = 0;
  for (int i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    if (a == 0 && b == 0)
      ++mp00;
    else if (b == 0)
      ++mp[make_pair(1, 0)];
    else if (a == 0)
      ++mp[make_pair(0, -1)];
    else if (b < 0) {
      b *= -1;
      ++mp[make_pair(a / gcd(a, b), b / gcd(a, b) * (-1))];
    } else
      ++mp[make_pair(a / gcd(a, b), b / gcd(a, b))];
  }
  long long ans = 1;
  for (auto [ab, value] : mp) {
    long long a = ab.first, b = ab.second;
    pair<long long, long long> np;
    if (b < 0)
      np = make_pair(b * (-1), a);
    else
      np = make_pair(b, a * (-1));
    ans *= (mkai(value) + mkai(mp[np]) - 1) % MOD;
    mp.erase(np);
    ans %= MOD;
  }
  ans += mp00 % MOD;
  cout << ans - 1 << endl;
}
