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

namespace petlja2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] x = Console.ReadLine().Split();
            int w = int.Parse(x[0]), h = int.Parse(x[1]), r = int.Parse(x[2]), q = int.Parse(x[3]);
            double[] keks = new double[w+1];
            for (int i = 0; i < keks.Length; i++)
            {
                keks[i] = h;
            }
            List<double> lal = new List<double>();
            for (int i = 0; i < q; i++)
            {
                x = Console.ReadLine().Split();
                if (x[0] == "1")
                    jede(keks, int.Parse(x[1]), int.Parse(x[2]), r);
                else
                    meri(int.Parse(x[1]), keks, lal);
            }
            foreach (double ks in lal)
                Console.WriteLine(ks);
        }

        static void jede(double[] keks, int x1, int y1, int r)
        {
            double vis;
            for (int i = 0; i < keks.Length; i++)
            {
                vis = y1 - Math.Sqrt(r * r - (x1 - i) * (x1 - i));
                if (vis < 0)
                    keks[i] = 0;
                else if (keks[i] - vis > 0)
                    keks[i] = vis;
            }
        }
        static void meri(int x,double[] keks, List<double> lal)
        {
            lal.Add(keks[x]);
        }
    }
}