#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
long long p = 1e9 + 7;
const double PI = 3.14159265358979323846;
long long powM(long long x, long long y, long long m = p) {
  long long ans = 1, r = 1;
  x %= m;
  while (r > 0 && r <= y) {
    if (r & y) {
      ans *= x;
      ans %= m;
    }
    r <<= 1;
    x *= x;
    x %= m;
  }
  return ans;
}
void solve() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  map<long double, int> m;
  int az = 0;
  int bz = 0;
  int abz = 0;
  for (int i = 0; i < n; i++) {
    long double a;
    long double b;
    cin >> a >> b;
    if (a == 0.0 && b == 0.0) {
      abz++;
    }
    if (!(a == 0.0 && b == 0.0)) {
      if (a == 0.0) az++;
      if (b == 0.0) bz++;
      if (a != 0.0 && b != 0.0) {
        m[a / b]++;
      }
    }
  }
  long long ans = 1;
  if (az != 0) {
    ans += powM(2, az) - 1;
  }
  if (bz != 0) {
    ans += powM(2, bz) - 1;
  }
  ans %= mod;
  for (auto pair : m) {
    long double d = pair.first;
    int cnt = pair.second;
    if (cnt != 0) {
      long long tmp = powM(2, cnt);
      int cnt2 = m[-1.0 / d];
      if (cnt2 != 0) {
        tmp += powM(2, cnt2) - 1;
        tmp %= p;
        m[-1.0 / d] = 0;
      }
      ans *= tmp;
      ans %= p;
    }
  }
  ans += abz;
  cout << (ans - 1 + p) % p;
  return 0;
  return 0;
}
