#include <bits/stdc++.h>
using namespace std;
long long mod(long long a) {
  long long c = a % (long long)(1E9 + 7);
  if (c >= 0) return c;
  return c + (long long)(1E9 + 7);
}
long long inf = (long long)1E18;
long long max(long long a, long long b) {
  if (a < b)
    return b;
  else
    return a;
}
long long min(long long a, long long b) {
  if (a > b)
    return b;
  else
    return a;
}
void Max(long long &pos, long long val) { pos = max(pos, val); }
void Min(long long &pos, long long val) { pos = min(pos, val); }
void Add(long long &pos, long long val) { pos = mod(pos + val); }
long double EPS = 1E-9;
struct data {
  long long val[2];
};
long long gcd(long long x, long long y) {
  if (x < y) return gcd(y, x);
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long hpow(long long x, long long y) {
  long long ans = 1;
  long long i = x;
  if (y == 0) return 1;
  while (y > 0) {
    if (y % 2 == 1) {
      ans = (ans * i) % (long long)(1E9 + 7);
    }
    i = (i * i) % (long long)(1E9 + 7);
    y = y / 2;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  map<pair<long long, long long>, data> mp;
  long long a[n], b[n];
  for (long long i = 0; i <= n - 1; i++) {
    cin >> a[i] >> b[i];
    if (a[i] != 0 && b[i] != 0) {
      long long g = gcd(abs(a[i]), abs(b[i]));
      a[i] /= g;
      b[i] /= g;
    }
    long long flag = 0;
    if (a[i] >= 0 && b[i] > 0) {
      flag = 0;
    } else if (a[i] > 0 && b[i] <= 0) {
      long long aa = a[i];
      long long bb = b[i];
      a[i] = -1 * bb;
      b[i] = aa;
      flag = 1;
    } else if (a[i] <= 0 && b[i] < 0) {
      a[i] = -a[i];
      b[i] = -b[i];
      flag = 0;
    } else {
      long long aa = a[i];
      long long bb = b[i];
      a[i] = bb;
      b[i] = -1 * aa;
      flag = 1;
    }
    if (a[i] == 0) {
      if (b[i] == 0) {
        mp[pair<long long, long long>(a[i], b[i])].val[0] = 0;
        mp[pair<long long, long long>(a[i], b[i])].val[1] = 0;
        continue;
      } else {
        b[i] = 1;
      }
    }
    if (mp.find(pair<long long, long long>(a[i], b[i])) == mp.end()) {
      mp[pair<long long, long long>(a[i], b[i])].val[flag] = 1;
      mp[pair<long long, long long>(a[i], b[i])].val[1 - flag] = 0;
    } else {
      mp[pair<long long, long long>(a[i], b[i])].val[flag]++;
    }
  }
  long long ans = 1;
  for (auto i = mp.begin(); i != mp.end(); ++i) {
    pair<long long, long long> key = i->first;
    data value;
    value.val[0] = i->second.val[0];
    value.val[1] = i->second.val[1];
    long long x = key.first;
    long long y = key.second;
    ans = mod(ans * (hpow(2, value.val[0]) + hpow(2, value.val[1]) - 1));
  }
  cout << ans - 1 << "\n";
  return 0;
}
