#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long LLINF = 1e18;
const long long MOD = 1000000000 + 7;
const int MSIZE = 100007;
const double Pi = 3.14159265358979323146;
long long gcd(long long a, long long b) {
  if (a < b) return gcd(b, a);
  if (a % b == 0 || b == 1) return b;
  return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  map<pair<long long, long long>, long long> mp;
  vector<pair<long long, long long>> id;
  vector<long long> group_num;
  int zero = 0;
  for (int i = 0; i < (int)(n); i++) {
    long long a, b;
    cin >> a >> b;
    pair<long long, long long> group;
    if (a == 0 && b == 0) {
      zero++;
    } else if (a == 0 || b == 0) {
      a /= (a == 0 ? 1 : a);
      b /= (b == 0 ? 1 : b);
      long long sa = (a == 0 ? b : a);
      group = make_pair(sa, 0);
    } else {
      int aa = abs(a), ab = abs(b);
      int g = gcd(aa, ab);
      if ((a < 0 && b > 0) || (a > 0 && b < 0)) {
        ab *= -1;
      }
      group = make_pair(aa / g, ab / g);
    }
    if (mp[group] == 0) {
      id.emplace_back(group);
    }
    mp[group]++;
  }
  long long ans = 1;
  for (int i = 0; i < (int)(id.size()); i++) {
    if (mp[id[i]] == 0) continue;
    if (id[i].first == 0 && id[i].second == 0) continue;
    long long oa = id[i].second;
    long long ob = -id[i].first;
    if (oa < 0 && ob < 0) {
      oa *= -1;
      ob *= -1;
    }
    pair<long long, long long> other = make_pair(oa, ob);
    long long g = 0;
    g += pow(2, mp[id[i]]) - 1;
    g += (mp[other] == 0 ? 0 : pow(2, mp[other]) - 1);
    g++;
    mp[id[i]] = 0;
    mp[other] = 0;
    group_num.emplace_back(g);
  }
  for (int i = 0; i < (int)(group_num.size()); i++) {
    ans *= group_num[i];
    ans %= MOD;
  }
  ans--;
  ans += zero;
  ans %= MOD;
  cout << ans << endl;
  return 0;
}
