using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var zz = 0L;
            var zx = 0L;
            var xz = 0L;
            var dct = new Dictionary<(long l, long r), (long p, long m)>();
            for (var i = 0; i < N; ++i)
            {
                var (A, B) = Slice2<long>();
                //0を含む場合
                if (0 == A * B)
                {
                    if (A == 0 && B == 0)//どう組み合わせても0になる。単品で使う
                        ++zz;
                    else if (A == 0)//(0,i),(0,0)とは組み合わせれない。他とはいける
                        ++xz;
                    else
                        ++zx;
                }
                else
                {
                    //Ai*Aj+Bi*Bj=0→Ai/Bi+Bj/Aj=0。
                    //最大公約数で割ればいい感じに扱える
                    var gcd = Gcd(Abs(A), Abs(B));
                    A /= gcd; B /= gcd;
                    if (0 < A * B)//Ai/Bi側
                    {
                        var t = (Abs(A), Abs(B));
                        if (!dct.ContainsKey(t)) dct[t] = (0, 0);
                        dct[t] = (dct[t].p + 1, dct[t].m);
                    }
                    else//Bj/Aj側
                    {
                        var t = (Abs(B), Abs(A));
                        if (!dct.ContainsKey(t)) dct[t] = (0, 0);
                        dct[t] = (dct[t].p, dct[t].m + 1);
                    }
                }
            }
            //Aiを使うときはAjを使わない。Ajを使うときはAiを使わない
            var nb = 1L;//空集合を含む
            foreach (var d in dct)
            {
                var t = ModPow(2, d.Value.p, Mod) + ModPow(2, d.Value.m, Mod) - 1;//空集合が重複なので-1
                nb = (nb * t + Mod) % Mod;
            }
            var nzx = ModPow(2, zx, Mod) * nb % Mod;//空集合を含む
            var nxz = ModPow(2, xz, Mod) * nb % Mod;//空集合を含む
            //nbのみを2回、空集合を2回カウントしているので減らす
            var ans = (zz + nzx + nxz - nb - 1 + Mod) % Mod;
            WriteLine(ans);
        }
        static long Gcd(long x, long y) => y == 0 ? x : Gcd(y, x % y);
        static long ModPow(long a, long n, long mod)
        {
            var res = 1L;
            while (0 < n)
            {
                if (n % 2 != 0) res = res * a % mod;
                a = a * a % mod;
                n >>= 1;
            }
            return res;
        }
        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 66956