using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp33
{
    class Program
    {
        static void Main(string[] args)
        {

            int  c = 0;
            int q, w, h, r, x = 0, y = 0;
            string[] v = Console.ReadLine().Split();
            w = int.Parse(v[0]);
            h = int.Parse(v[1]);
            r = int.Parse(v[2]);
            q = int.Parse(v[3]);
            double[] a = new double[q];
            double[] xi = new double[q];
            double[] yi = new double[q];
            // double[] xp = new double[q];
            for (int i = 0; i < q; i++)
            { yi[i] = h; }
            for (int i = 0; i < q; i++)
            { xi[i] = i; }
            int j = 0;
            while (j < q)
            {

                string[] p = Console.ReadLine().Split();
                int k = int.Parse(p[0]);
                switch (k)
                {
                    case 1:
                        //string[] r2 = Console.ReadLine().Split();
                        x = int.Parse(p[1]);
                        y = int.Parse(p[2]);
                        for (int i = 0; i < w; i++)
                        {
                            if (Math.Abs(x - xi[i]) < r && y - yi[i] < r)
                            { yi[i] = y - Math.Sqrt(Math.Pow(r, 2) - Math.Pow(x - xi[i], 2)); }
                        }
                        j++;
                        break;
                    case 2:
                        x = int.Parse(p[1]);
                        a[c] = yi[x];

                        // xp[j] = x;
                        c++;
                        j++;
                        break;

                    default:
                        break;
                }
            }

            //  Console.WriteLine(yi[2]);





            for (int i = 0; i < c; i++) { Console.WriteLine(a[i]/*+/*" "+/*xp[i]*/); }
            Console.ReadLine();

        }
    }
}