#include <stdio.h>
int main(void){
   int i,ii, iii, n;
   scanf("%d", &n);
   long long int a[200001], b[200001];
   double d[200001], e[200001];
   long long int ans;
   int flag[200001] = {};
   int q[200001];
   for (i = 0; i < n; i++)
        q[i]= 1;
   for (i = 0; i < n; i++)
    {
        scanf("%lld %lld", a + i, b + i);
        d[i] = (double)a[i] / b[i];
        e[i] = (double)b[i] / a[i];
    }
    for (i = 0; i < n; i++)
    {
        for (ii = i + 1; i < n; i++)
        {
            if (d[i] == (-1) * e[ii] && flag[i] == 0)
            {
                flag[ii] = 1;
                q[ii] = 0;
                q[i]++;   
            }
            
        }
            
    }
  ans =1;
  for (i = 0; i < n; i++)
    ans = ans * (q[i] + 1) % 1000000007;
    printf("%lld", ans - 1);
  
  
    return (0);
}
