using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Abc168E
    {
        static long mod = 1000000007;

        struct Q
        {
            public long X;
            public long Y;
            public Q(long x, long y)
            {
                if (y < 0)
                {
                    x = -x;
                    y = -y;
                }
                if (x != 0 && y != 0)
                {
                    var r = GetGCD(Math.Abs(x), y);
                    x /= r;
                    y /= r;
                }
                else if (x != 0)
                    y = long.MaxValue;
                else if (y != 0)
                    x = long.MaxValue;
                X = x;
                Y = y;
            }
        }


        public static void Main()
        {
            var n = int.Parse(Console.ReadLine());
            var count = new Dictionary<Q, (int qn, int pn)>();
            var zeroN = 0;
            for (int i = 0; i < n; i++)
            {
                var ab = Console.ReadLine().Split(' ').Select(j => long.Parse(j)).ToArray();
                var a = ab[0];
                var b = ab[1];

                if (a == 0 && b == 0)
                {
                    zeroN++;
                    continue;
                }

                var q = new Q(a, b);
                var p = new Q(-b, a);
                (int qn, int pn) temp;
                if (count.TryGetValue(q, out temp))
                {
                    temp.qn++;
                    count[q] = temp;
                }
                else if (count.TryGetValue(p, out temp))
                {
                    temp.pn++;
                    count[p] = temp;
                }
                else
                    count[q] = (qn: 1, pn: 0);
            }

            long ans = 1;
            foreach (var item in count.Values)
                ans = (ModPower(2, item.qn) + ModPower(2, item.pn) - 1) % mod * ans % mod;
            Console.WriteLine(ans + zeroN - 1 % mod);
        }

        public static long GetGCD(long a, long b)
        {
            if (a < b)
            {
                var t = b;
                b = a;
                a = t;
            }

            while (b > 0)
            {
                var r = a % b;
                a = b;
                b = r;
            }
            return a;
        }

        public static long ModPower(long a, long n)
        {
            long ret = 1;
            while (n > 0)
            {
                if (n % 2 == 1)
                    ret = ret * a % mod;
                a = a * a % mod;
                n /= 2;
            }
            return ret;
        }
    }
}
