#include <bits/stdc++.h>
using namespace std;
const long long MODULO = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (a == 0 || b == 0) {
    return a + b;
  } else if (a > b) {
    return gcd(a % b, b);
  } else {
    return gcd(a, b % a);
  }
}
struct Fraction {
  long long x, y;
  int sign;
  Fraction(long long x0, long long y0) : x(x0), y(y0) {
    long long g = gcd(abs(x), abs(y));
    x /= g;
    y /= g;
    if (x < 0 && y < 0) {
      x = -x;
      y = -y;
    }
    if (x < 0 || y < 0) {
      sign = -1;
      x = abs(x);
      y = abs(y);
    } else {
      sign = 1;
    }
  }
  bool operator<(const Fraction &other) const {
    return sign < other.sign || (sign == other.sign &&
                                 make_pair(x, y) < make_pair(other.x, other.y));
  }
};
void add_self(long long &a, long long b) {
  a += b;
  if (a >= MODULO) {
    a -= MODULO;
  }
}
long long mul(long long a, long long b) { return a * b % MODULO; }
long long power(int base, int exp) {
  if (exp == 0) {
    return 1;
  }
  if (exp == 1) {
    return base;
  }
  long long half = power(base, exp / 2);
  if (exp % 2 == 0) {
    return mul(half, half);
  } else {
    return mul(base, mul(half, half));
  }
}
long long sub(long long a, long long b) {
  a -= b;
  if (a < 0) {
    a += MODULO;
  }
  return a;
}
void sub_self(long long &a, long long b) { a = sub(a, b); }
void mul_self(long long &a, long long b) { a = mul(a, b); }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n0, n = 0;
  cin >> n0;
  vector<long long> a, b;
  for (int i = 0; i < n0; i++) {
    long long aa, bb;
    cin >> aa >> bb;
    if (aa == 0 && bb == 0) {
      continue;
    }
    a.push_back(aa);
    b.push_back(bb);
    n++;
  }
  int a0_cnt = 0, b0_cnt = 0;
  map<Fraction, int> cnt;
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] == 0) {
      a0_cnt++;
    } else if (b[i] == 0) {
      b0_cnt++;
    } else {
      cnt[Fraction(a[i], b[i])]++;
    }
  }
  set<Fraction> used;
  long long ans = 1;
  for (auto [f, c] : cnt) {
    if (used.count(f)) {
      continue;
    }
    Fraction f1((-f.sign) * f.y, f.x);
    used.insert(f1);
    used.insert(f);
    int c1 = cnt[f1];
    long long ans1 = sub(power(2, c), 1);
    add_self(ans1, sub(power(2, c1), 1));
    add_self(ans1, 1);
    mul_self(ans, ans1);
  }
  sub_self(ans, 1);
  add_self(ans, n0 - n);
  cout << ans << '\n';
}
