import java.util.*;
import java.io.*;
import java.lang.reflect.Array;

		public class codeforces
		{
			public static void main(String[] args)
			{
				InputReader in = new InputReader(System.in);
				PrintWriter pw = new PrintWriter(System.out);

				int n = in.nextInt();
				long U = in.nextLong();
				long[] E = new long[n];
				double max = -1;

				for(int i=0;i<n;i++)
					E[i] = in.nextLong();

				for(int k=1;k<n-1;k++)
				{
					int i = k + 1, j = n - 1, mid = 0;
					double T = 0;

					while(i < j)
					{
						mid = (int)Math.ceil((double)(i+j)/2);

						if(E[mid] - E[k-1] <= U)
							i = mid;
						else
							j = mid - 1;
					}

					j = k;
					k = i;
					i = j - 1;

					T = E[k] - E[j];
					T /= E[k] - E[i];

					if(E[k] - E[i] <= U)
						max = Math.max(max, T);

					k = j;
				}

				pw.println(max);

				pw.flush();
				pw.close();
			}

		/*	public static void DFS(int sourse)
			{
				int count = 0;
				visited[sourse] = true;

				for(int u : adj[sourse])
				{
					if(!visited[u])
					{
						DFS(u);
					}
				}

			}*/

			public static ArrayList Divisors(long n)
			{
			    ArrayList<Long> div = new ArrayList<>();

			    for (long i=1; i<=Math.sqrt(n); i++)
			    {
			        if (n%i == 0)
			        {
			        	div.add(i);

			            if(n/i != i)
			            	div.add(n/i);
			        }
			    }
			    return div;
			}

			public static int BinarySearch(long[] a, long k)
			{
				int n = a.length;
				int i = 0, j = n-1;
				int mid = 0;

				if(k < a[0])
					return 0;
				else if(k >= a[n-1])
					return n;
				else
				{
					while(j - i > 1)
					{
						mid = (i+j)/2;

						if(k >= a[mid])
							i = mid;
						else
							j = mid;
					}
				}

				return i+1;
			}
			public static long GCD(long a,long b)
			{
				if(b==0)
					return a;
				else
					return GCD(b,a%b);
			}

			static class pair implements Comparable<pair>
			{
				Integer x, y;
				pair(int x,int y)
				{
					this.x=x;
					this.y=y;
				}

				public int compareTo(pair o) {
					int result = x.compareTo(o.x);
					if(result==0)
						result = y.compareTo(o.y);

					return result;
				}

				public String toString()
				{
					return x+" "+y;
				}

				public boolean equals(Object o)
				{
					if (o instanceof pair)
				    {
						pair p = (pair)o;
						return p.x - x == 0 && p.y - y == 0 ;
					}
					return false;
				}

				public int hashCode()
				{
					return new Long(x).hashCode()*31 + new Long(y).hashCode();
				}
			}

			static class InputReader
			{

				private final InputStream stream;
				private final byte[] buf = new byte[8192];
				private int curChar, snumChars;
				private SpaceCharFilter filter;

				public InputReader(InputStream stream)
				{
					this.stream = stream;
				}

				public int snext()
				{
					if (snumChars == -1)
						throw new InputMismatchException();
					if (curChar >= snumChars)
					{
						curChar = 0;
						try
						{
							snumChars = stream.read(buf);
						}
						catch (IOException e)
						{
							throw new InputMismatchException();
						}
						if (snumChars <= 0)
							return -1;
					}
					return buf[curChar++];
				}

				public int nextInt()
			    {
					int c = snext();
					while (isSpaceChar(c))
					{
						c = snext();
					}
					int sgn = 1;
					if (c == '-')
				    {
						sgn = -1;
						c = snext();
					}
					int res = 0;
					do
					{
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						res *= 10;
						res += c - '0';
						c = snext();
					} while (!isSpaceChar(c));
					return res * sgn;
				}

				public long nextLong()
			    {
					int c = snext();
					while (isSpaceChar(c))
					{
						c = snext();
					}
					int sgn = 1;
					if (c == '-')
					{
						sgn = -1;
						c = snext();
					}
					long res = 0;
					do
					{
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						res *= 10;
						res += c - '0';
						c = snext();
					} while (!isSpaceChar(c));
					return res * sgn;
				}

				public int[] nextIntArray(int n)
				{
					int a[] = new int[n];
					for (int i = 0; i < n; i++)
					{
						a[i] = nextInt();
					}
					return a;
				}

				public String readString()
			    {
					int c = snext();
					while (isSpaceChar(c))
					{
						c = snext();
					}
					StringBuilder res = new StringBuilder();
					do
					{
						res.appendCodePoint(c);
						c = snext();
					} while (!isSpaceChar(c));
					return res.toString();
				}

				public String nextLine()
				{
					int c = snext();
					while (isSpaceChar(c))
						c = snext();
					StringBuilder res = new StringBuilder();
					do
					{
						res.appendCodePoint(c);
						c = snext();
					} while (!isEndOfLine(c));
					return res.toString();
				}

				public boolean isSpaceChar(int c)
				{
					if (filter != null)
						return filter.isSpaceChar(c);
					return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
				}

				private boolean isEndOfLine(int c)
				{
					return c == '\n' || c == '\r' || c == -1;
				}

				public interface SpaceCharFilter
			    {
					public boolean isSpaceChar(int ch);
				}
			}

			static class CodeX {
	        public static void sort(long arr[]) {
	            merge_sort(arr, 0, arr.length - 1);
	        }

	        private static void merge_sort(long A[], long start, long end) {
	            if (start < end) {
	                long mid = (start + end) / 2;
	                merge_sort(A, start, mid);
	                merge_sort(A, mid + 1, end);
	                merge(A, start, mid, end);
	            }

	        }

	        private static void merge(long A[], long start,long mid, long end) {
	            long p = start, q = mid + 1;
	            long Arr[] = new long[(int)(end - start + 1)];
	            long k = 0;

	            for (int i = (int)start; i <= end; i++) {
	                if (p > mid)
	                    Arr[(int)k++] = A[(int)q++];

	                else if (q > end)
	                    Arr[(int)k++] = A[(int)p++];

	                else if (A[(int)p] < A[(int)q])
	                    Arr[(int)k++] = A[(int)p++];

	                else
	                    Arr[(int)k++] = A[(int)q++];
	            }
	            for (int i = 0; i < k; i++) {
	                A[(int)start++] = Arr[i];
	            }

	        }

	    }
		}


import java.util.*;
import java.io.*;

public class Three{
    public static void main(String[] args) {
	Scanner in = new Scanner (System.in);
	PrintWriter out = new PrintWriter(System.out);

	pair[] points = new pair [3];
	for (int i = 0; i < 3; ++i) {
	    int x = in.nextInt();
	    int y = in.nextInt();
	    points[i] = new pair (x, y);
	}

	Arrays.sort(points);

	int MaxY = Math.max(Math.max(points[0].y, points[1].y), points[2].y);
	int MinY = Math.min(Math.min(points[0].y, points[1].y), points[2].y);

	out.println(MaxY - MinY + points[2].x - points[0].x + 1);
	for (int i = MinY; i <= MaxY; ++i)
	    out.println(points[1].x + " " + i);
	for (int i = points[0].x; i < points[1].x; ++i)
	    out.println(i + " " + points[0].y);
	for (int i = points[1].x + 1; i <= points[2].x; ++i)
	    out.println(i + " " + points[2].y);

	out.close();
    }

    public static class pair implements Comparable<pair> {
	int x, y;
	public pair (int x_, int y_) {
	    x = x_; y = y_;
	}

	@Override
	public int compareTo(pair o) {
	    return x - o.x;
	}
    }
}


import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class Problem
{

    static int mod = (int) (1e9+7);
    static InputReader in;
    static PrintWriter out;
    static int[] rt;
    static int[] size;

    static void initialize(int n){
        rt = new int[n + 1];
        size = new int[n + 1];
        for(int i = 0; i < rt.length; i++){
            rt[i] = i;
            size[i] = 1;
        }
    }

    static int root(int x){
        while(rt[x] != x){
            rt[x] = rt[rt[x]];
            x = rt[x];
        }
        return x;
    }

    static long union(int x,int y){
        int root_x = root(x);
        int root_y = root(y);
        if(root_x == root_y) return 0;
        long val = size[root_x] *1l* size[root_y];
        if(size[root_x]<size[root_y]){
            rt[root_x] = rt[root_y];
            size[root_y] += size[root_x];
        }
        else{
            rt[root_y] = rt[root_x];
            size[root_x] += size[root_y];
        }

        return val;
    }

    static void solve()
    {
        in = new InputReader(System.in);
        out = new PrintWriter(System.out);

        int t = 1;

        while(t-- > 0){
            int n = in.nextInt();
            int[] arr = in.nextIntArray(n);
            ArrayList<Pair> list = new ArrayList<>();

            for(int i = 1; i < n; i++){
                int u = in.nextInt() - 1;
                int v = in.nextInt() - 1;
                list.add(new Pair(u, v, Math.max(arr[u],arr[v])));
            }
            list.sort((p1,p2) -> Integer.compare(p1.i, p2.i));
            initialize(n);
            long s1 = 0;
            for(int i = 0; i < list.size(); i++){
                s1 += union(list.get(i).x, list.get(i).y) * list.get(i).i;
            }
            for(int i = 0; i < list.size(); i++){
                Pair p = list.get(i);
                p.i = Math.min(arr[p.x],arr[p.y]);
            }
            list.sort((p1,p2) -> -Integer.compare(p1.i, p2.i));
            initialize(n);
            long s2 = 0;
            for(int i = 0; i < list.size(); i++){
                s2 += union(list.get(i).x, list.get(i).y) * list.get(i).i;
            }

            out.println(s1 - s2);
        }

        out.close();
    }

    public static void main(String[] args)
    {
        new Thread(null ,new Runnable(){
            public void run(){
                try{
                    solve();
                } catch(Exception e){
                    e.printStackTrace();
                }
            }
        },"1",1<<26).start();

    }

    static class Pair implements Comparable<Pair>
    {

        int x,y;
        int i;

        Pair (int x,int y)
        {
                this.x = x;
                this.y = y;
        }

        Pair (int x,int y, int i)
        {
                this.x = x;
                this.y = y;
                this.i = i;
        }

        public int compareTo(Pair o)
        {
            if(this.x != o.x)
                return -Integer.compare(this.x, o.y);
            return -Integer.compare(this.y,o.y);
                //return 0;
        }

        public boolean equals(Object o)
        {
            if (o instanceof Pair)
            {
                Pair p = (Pair)o;
                return p.x == x && p.y==y;
            }
            return false;
        }

        @Override
        public String toString()
        {
            return x + " "+ y + " "+i;
        }

        /*public int hashCode()
        {
            return new Long(x).hashCode() * 31 + new Long(y).hashCode();
        }*/

    }

    static long add(long a,long b){
        long x=(a+b);
        while(x>=mod) x-=mod;
        return x;
    }

    static long sub(long a,long b){
        long x=(a-b);
        while(x<0) x+=mod;
        return x;
    }

    static long mul(long a,long b){
        long x=(a*b);
        while(x>=mod) x-=mod;
        return x;
    }

    static String rev(String s){
        StringBuilder sb=new StringBuilder(s);
        sb.reverse();
        return sb.toString();
    }

    static long gcd(long x,long y)
    {
        if(y==0)
                return x;
        else
                return gcd(y,x%y);
    }

    static int gcd(int x,int y)
    {
        if(y==0)
                return x;
        else
                return gcd(y,x%y);
    }

    static long pow(long n,long p,long m)
    {
         long  result = 1;
          if(p==0){
            return n;
          }

        while(p!=0)
        {
            if(p%2==1)
                result *= n;
            if(result >= m)
               result %= m;
            p >>=1;
            n*=n;
            if(n >= m)
                n%=m;
        }

        return result;
    }

    static long pow(long n,long p)
    {
        long  result = 1;
          if(p==0)
            return 1;

        while(p!=0)
        {
            if(p%2==1)
                result *= n;
            p >>=1;
            n*=n;
        }
        return result;
    }

    static void debug(Object... o)
    {
            System.out.println(Arrays.deepToString(o));
    }

    static class InputReader
    {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream)
        {
                this.stream = stream;
        }

        public int snext()
        {
                if (snumChars == -1)
                        throw new InputMismatchException();
                if (curChar >= snumChars)
                {
                        curChar = 0;
                        try
                        {
                                snumChars = stream.read(buf);
                        } catch (IOException e)
                        {
                                throw new InputMismatchException();
                        }
                        if (snumChars <= 0)
                                return -1;
                }
                return buf[curChar++];
        }

        public int nextInt()
        {
                int c = snext();
                while (isSpaceChar(c))
                {
                        c = snext();
                }
                int sgn = 1;
                if (c == '-')
                {
                        sgn = -1;
                        c = snext();
                }
                int res = 0;
                do
                {
                        if (c < '0' || c > '9')
                                throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = snext();
                } while (!isSpaceChar(c));
                return res * sgn;
        }

        public long nextLong()
        {
                int c = snext();
                while (isSpaceChar(c))
                {
                        c = snext();
                }
                int sgn = 1;
                if (c == '-')
                {
                        sgn = -1;
                        c = snext();
                }
                long res = 0;
                do
                {
                        if (c < '0' || c > '9')
                                throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = snext();
                } while (!isSpaceChar(c));
                return res * sgn;
        }

        public int[] nextIntArray(int n)
        {
                int a[] = new int[n];
                for (int i = 0; i < n; i++)
                {
                        a[i] = nextInt();
                }
                return a;
        }

        public long[] nextLongArray(int n)
        {
                long a[] = new long[n];
                for (int i = 0; i < n; i++)
                {
                        a[i] = nextLong();
                }
                return a;
        }

        public String readString()
        {
                int c = snext();
                while (isSpaceChar(c))
                {
                        c = snext();
                }
                StringBuilder res = new StringBuilder();
                do
                {
                        res.appendCodePoint(c);
                        c = snext();
                } while (!isSpaceChar(c));
                return res.toString();
        }

        public String nextLine()
        {
                int c = snext();
                while (isSpaceChar(c))
                        c = snext();
                StringBuilder res = new StringBuilder();
                do
                {
                        res.appendCodePoint(c);
                        c = snext();
                } while (!isEndOfLine(c));
                return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
                if (filter != null)
                        return filter.isSpaceChar(c);
                return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c)
        {
                return c == '\n' || c == '\r' || c == -1;
        }

        public interface SpaceCharFilter
        {
                public boolean isSpaceChar(int ch);
        }

    }
}


import java.util.Arrays;
import java.util.Scanner;

public class Solution {

    private static int[] a;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt(), m = sc.nextInt();

        a = new int[101];
        for (int i = 0; i < m; i++) {
            int type = sc.nextInt();
            a[type] = a[type] + 1;
        }

        int lo=1, hi=100, max=0;

        while (lo <= hi) {
            int mid = lo + (hi - lo)/2;
            if (check(n, mid)) {
                max = mid;
                lo = mid+1;
            } else {
                hi = mid -1;
            }
        }
        System.out.println(max);
    }

    public static boolean check(int n, int target) {
        int result = 0;
        for (int i=0; i <a.length; i++) {
            result = result + (a[i] / target);
        }
        if (result >= n) {return true;}
        return false;
    }
}


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Solution {
	public static void main(String[] args) {
		Solution solution = new Solution();
		System.out.println(solution.solve());
	}

	private int solve() {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();

		int[] a = new int[m];
		for (int i = 0; i < m; ++i) a[i] = in.nextInt();

		if (n > m) return 0;

		Map<Integer, Integer> map = new HashMap<>();
		for (int k: a) map.put(k, map.getOrDefault(k, 0) + 1);

		List<Integer> keySet = new ArrayList<>(map.keySet());
		int end = m / n;

		keySet.sort((u, v) -> -Integer.compare(u, v));
		do {
			int count = 0;
			for (int k: keySet) {
				count += map.get(k) / end;
				if (count >= n) return end;
			}
		} while (--end > 0);

		return 0;
	}
}


import java.io.*;
import java.util.*;

public class p7{

	static class FastReader{
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new
					InputStreamReader(System.in));
		}

		String next()
		{
			while (st == null || !st.hasMoreElements())
			{
				try
				{
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}

		long nextLong()
		{
			return Long.parseLong(next());
		}

		double nextDouble()
		{
			return Double.parseDouble(next());
		}

		String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args)
	{
        FastReader sc = new FastReader();
        //PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
		int k = sc.nextInt();
		long one = (long)Math.pow(2, k) - 1;

		long[] arr = new long[n+1];

		arr[0] = 0;
		for(int i=1;i<=n;i++){
			arr[i] = sc.nextLong();
			arr[i] ^= arr[i-1];
		}

		Map<Long, Long> count = new HashMap<>();

		for(int i=0;i<=n;i++){
			Long key = Math.min(arr[i], (arr[i]^one));
			Long val = count.get(key);
			if(val==null) val = 0L;
			count.put(key, val+1);
		}

		long num = n;
		long ans = num*(num+1)/2;

		for(Map.Entry<Long, Long> ent: count.entrySet()){

			Long cnt = ent.getValue();

			long num1 = cnt/2;
			long num2 = (cnt+1)/2;

			ans -= ( (num1*(num1-1))/2 );
			ans -= ( (num2*(num2-1))/2 );
		}

		System.out.println(ans);
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author caoash
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BObtainingTheString solver = new BObtainingTheString();
        solver.solve(1, in, out);
        out.close();
    }

    static class BObtainingTheString {
        public void solve(int testNumber, FastScanner br, PrintWriter pw) {
            int n = br.nextInt();
            String s = br.nextString();
            String t = br.nextString();
            char[] sarr = new char[n];
            char[] tarr = new char[n];
            int[] sAppear = new int[26];
            int[] tAppear = new int[26];
            for (int i = 0; i < s.length(); i++) {
                sarr[i] = s.charAt(i);
                tarr[i] = t.charAt(i);
                sAppear[s.charAt(i) - 'a']++;
                tAppear[t.charAt(i) - 'a']++;
            }
            for (int i = 0; i < 26; i++) {
                if (sAppear[i] != tAppear[i]) {
                    pw.println(-1);
                    pw.close();
                }
            }
            ArrayList<Integer> ans = new ArrayList<Integer>();
            for (int i = 0; i < n; i++) {
                char curr = tarr[i];
                for (int j = i + 1; j < n; j++) {
                    if (sarr[j] == curr) {
                        for (int k = j; k > i; k--) {
                            ans.add(k);
                            char temp = sarr[k - 1];
                            sarr[k - 1] = sarr[k];
                            sarr[k] = temp;
                        }
                        break;
                    }
                }
            }
            pw.println(ans.size());
            for (int e : ans) {
                pw.print(e + " ");
            }
            pw.close();
        }

    }

    static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastScanner.SpaceCharFilter filter;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.util.Scanner;

public class A961_Tetris {

	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);
		int platforms = input.nextInt();
		int in = input.nextInt();
		int[] cols = new int[platforms];
		int[] squares = new int[in];

		for (int i = 0; i < in; i ++) {
			squares[i] = input.nextInt();
		}

		boolean hi = false;
		int score = 0;

		for (int i = 0; i < in; i ++) {
			cols[squares[i] - 1] ++;
			hi = checkscore(cols);
			if (hi == true) {
				hi = false;
				score ++;
				for (int j = 0; j < cols.length; j ++) {
					cols[j] --;
				}

			}

		}

		System.out.println(score);

	}

	public static boolean checkscore(int[] cols) {
		for (int i = 0; i < cols.length; i ++) {
			if (cols[i] == 0) {
				return false;
			}

		}

		return true;

	}

}


import java.util.*;
import java.io.*;

public class RGBSubstring {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int Q = scanner.nextInt();
        while(Q-->0) {
            int N = scanner.nextInt();
            int K = scanner.nextInt();
            String s1 = "RGB";
            String s2 = "GBR";
            String s3 = "BRG";
            char[] arr = scanner.next().toCharArray();
            int[] cnts = new int[3];
            for(int i = 0; i < K; i++) {
                int ind = i % 3;
                if (arr[i] != s1.charAt(ind)) cnts[0]++;
                if (arr[i] != s2.charAt(ind)) cnts[1]++;
                if (arr[i] != s3.charAt(ind)) cnts[2]++;
            }
            int ans = Math.min(Math.min(cnts[0], cnts[1]), cnts[2]);
            for(int i = K; i < N; i++) {
                int ind = (K-1)%3;
                int[] nextCnts = new int[3];
                nextCnts[1] = cnts[0];
                nextCnts[2] = cnts[1];
                nextCnts[0] = cnts[2];
                if ('R' != arr[i-K]) nextCnts[1]--;
                if ('G' != arr[i-K]) nextCnts[2]--;
                if ('B' != arr[i-K]) nextCnts[0]--;
                if (arr[i] != s1.charAt(ind)) nextCnts[0]++;
                if (arr[i] != s2.charAt(ind)) nextCnts[1]++;
                if (arr[i] != s3.charAt(ind)) nextCnts[2]++;
                cnts = nextCnts;
                for(int j = 0; j < 3; j++) ans = Math.min(ans, cnts[j]);
            }
            out.println(ans);
        }
        out.flush();
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }

        public FastScanner() {
            this(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] readIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
    }
}


// discussed with rainboy
import java.io.*;
import java.util.*;

public class CF915D {
	static ArrayList[] aa;
	static boolean[] visited, instack;
	static int[] stack;
	static int cnt, h_, i_, j_;
	static boolean dfs1(int i) {
		if (visited[i]) {
			if (instack[i]) {
				h_ = i;
				return true;
			}
			return false;
		}
		visited[i] = instack[i] = true;
		stack[cnt++] = i;
		ArrayList<Integer> adj = aa[i];
		for (int j : adj)
			if (dfs1(j))
				return true;
		instack[i] = false;
		cnt--;
		return false;
	}
	static boolean dfs2(int i) {
		if (visited[i])
			return instack[i];
		visited[i] = instack[i] = true;
		ArrayList<Integer> adj = aa[i];
		for (int j : adj)
			if (!(i == i_ && j == j_) && dfs2(j))
				return true;
		instack[i] = false;
		return false;
	}
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());
		aa = new ArrayList[n];
		for (int i = 0; i < n; i++)
			aa[i] = new ArrayList<Integer>();
		while (m-- > 0) {
			st = new StringTokenizer(br.readLine());
			int i = Integer.parseInt(st.nextToken()) - 1;
			int j = Integer.parseInt(st.nextToken()) - 1;
			aa[i].add(j);
		}
		visited = new boolean[n];
		instack = new boolean[n];
		stack = new int[n];
		for (int i = 0; i < n; i++)
			if (dfs1(i))
				break;
		if (cnt == 0) {
			System.out.println("YES");
			return;
		}
		for (j_ = h_, i_ = stack[--cnt]; ; j_ = i_, i_ = stack[--cnt]) {
			Arrays.fill(visited, false);
			Arrays.fill(instack, false);
			boolean cycle = false;
			for (int i = 0; i < n; i++)
				if (dfs2(i)) {
					cycle = true;
					break;
				}
			if (!cycle) {
				System.out.println("YES");
				return;
			}
			if (i_ == h_)
				break;
		}
		System.out.println("NO");
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskG solver = new TaskG();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskG {
        static final long MODULO = (long) 1e9 + 7;
        static final long BIG = Long.MAX_VALUE - Long.MAX_VALUE % MODULO;
        static final int[] ONE = new int[]{1};
        int k;
        int n;
        long[] globalRes;
        int[] p2;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            k = in.nextInt();
            globalRes = new long[k + 1];
            p2 = new int[n + 1];
            p2[0] = 1;
            for (int i = 1; i <= n; ++i) p2[i] = (int) (2 * p2[i - 1] % MODULO);
            Vertex[] vs = new Vertex[n];
            for (int i = 0; i < n; ++i) vs[i] = new Vertex();
            for (int i = 0; i < n - 1; ++i) {
                Vertex a = vs[in.nextInt() - 1];
                Vertex b = vs[in.nextInt() - 1];
                a.adj.add(b);
                b.adj.add(a);
            }
            vs[0].dfs(null);
            long[][] ways = new long[k + 1][k + 1];
            ways[0][0] = 1;
            for (int i = 1; i <= k; ++i) {
                for (int j = 1; j <= k; ++j) {
                    ways[i][j] = j * (ways[i - 1][j] + ways[i - 1][j - 1]) % MODULO;
                }
            }
            long sum = 0;
            for (int i = 1; i <= k; ++i) {
                long s = globalRes[i];
                s %= MODULO;
                sum = (sum + s * ways[k][i]) % MODULO;
            }
            out.println(sum);
        }

        class Vertex {
            int[] res;
            int subtreeSize;
            List<Vertex> adj = new ArrayList<>();

            public void dfs(Vertex parent) {
                subtreeSize = 1;
                int[] prod = ONE;
                for (Vertex child : adj)
                    if (child != parent) {
                        child.dfs(this);
                        subtreeSize += child.subtreeSize;
                    }
                int mult = 2;//p2[n - subtreeSize];
                for (Vertex child : adj)
                    if (child != parent) {
                        int[] c = child.res;
                        prod = mul(prod, c);
                        subFrom(globalRes, c, 1);
                    }
                addTo(globalRes, prod, mult);
                res = insertEdge(prod);
            }

            private int[] insertEdge(int[] a) {
                int len = a.length + 1;
                if (len > k) len = k + 1;
                int[] b = new int[len];
                b[0] = a[0] * 2;
                if (b[0] >= MODULO) b[0] -= MODULO;
                for (int i = 1; i < len; ++i) {
                    long s = a[i - 1];
                    if (i < a.length) s += a[i];
                    if (s >= MODULO) s -= MODULO;
                    s = s * 2;
                    if (s >= MODULO) s -= MODULO;
                    b[i] = (int) s;
                }
                b[1] -= 1;
                if (b[1] < 0) b[1] += MODULO;
                return b;
            }

            private void addTo(long[] a, int[] b, int mult) {
                for (int i = 0; i < b.length; ++i) {
                    long s = a[i] + b[i] * (long) mult;
                    if (s < 0) s -= BIG;
                    a[i] = s;
                }
            }

            private void subFrom(long[] a, int[] b, int mult) {
                for (int i = 0; i < b.length; ++i) {
                    long s = a[i] + (MODULO - b[i]) * (long) mult;
                    if (s < 0) s -= BIG;
                    a[i] = s;
                }
            }

            private int[] mul(int[] a, int[] b) {
                int len = a.length + b.length - 1;
                if (len > k) len = k + 1;
                int[] c = new int[len];
                for (int i = 0; i < len; ++i) {
                    long s = 0;
                    int left = Math.max(0, i - (b.length - 1));
                    int right = Math.min(a.length - 1, i);
                    for (int ia = left; ia <= right; ++ia) {
                        int ib = i - ia;
                        s += a[ia] * (long) b[ib];
                        if (s < 0) s -= BIG;
                    }
                    c[i] = (int) (s % MODULO);
                }
                return c;
            }

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        E solver = new E();
        solver.solve(1, in, out);
        out.close();
    }

    static class E {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.ni(), K = in.ni();
            long mod = 998244353;
            long[][] dp = new long[n + 1][n + 1];
            for (int lim = 1; lim <= n; lim++) {
                long sum = 1;
                dp[0][lim] = 1;
                for (int i = 1; i <= n; i++) {
                    dp[i][lim] = (dp[i][lim] + sum) % mod;
                    sum = (sum + dp[i][lim]) % mod;
                    if (i >= lim)
                        sum = (sum - dp[i - lim][lim] + mod) % mod;
                }
            }
            long ans = 0;
            for (int k = 1; k < Math.min(K, n + 1); k++) {
                long h = dp[n][k] - dp[n][k - 1];
                int lim = K / k;
                if (K % k == 0)
                    lim--;
                if (lim > n)
                    lim = n;
                ans += dp[n][lim] * h % mod;
            }
            out.println(2 * ans % mod);
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String ns() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(ns());
        }

    }
}


/**
 * @author: Mehul Raheja
 */

import java.util.*;
import java.io.*;

public class p3{

    /*
        Runtime = O()
     */
    static int N, M, K;
    static String s;
    static StringTokenizer st;
    static int[] d;

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        st = new StringTokenizer(br.readLine());
        int N = Integer.parseInt(st.nextToken());
        int R = Integer.parseInt(st.nextToken());
        double[] x = new double[N];
        st = new StringTokenizer(br.readLine());
        for (int i = 0; i < N; i++) {
            x[i] = Double.parseDouble(st.nextToken());
        }
        double[] y = new double[N];
        for (int i = 0; i < N; i++) {
          //  int found = -1;
            double maxy = R;
            for (int j = i-1; j >= 0; j--) {
                if(Math.abs(x[j] - x[i]) <= 2 * R){
                    maxy = Math.max(y[j] + inc(x[j] - x[i],R), maxy);
                }
            }

            y[i] = maxy;
        }

        for (int i = 0; i < y.length-1; i++) {
            System.out.print(y[i] + " ");
        }
        System.out.println(y[y.length-1]);
       // System.out.println(Arrays.toString(y));
    }

    public static  double inc(double x, double R){
        return Math.sqrt((4*R*R)-(x*x));
    }
}


import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        FastScanner sc=new FastScanner();
        PrintWriter pw=new PrintWriter(System.out);
        double eps=1e-12;
        while(sc.hasNext()){
            int n=sc.nextInt();
            int r=sc.nextInt();
            double[]shu=new double[n];
            for(int i=0;i<n;i++)shu[i]=sc.nextDouble();
            double[]res=new double[n];
            for(int i=0;i<n;i++){
                for(int j=0;j<i;j++){
                    double temp=Math.abs(shu[i]-shu[j]);
                    if(temp<2*r||Math.abs(temp-2*r)<eps){
                        res[i]=Math.max(res[i],res[j]+Math.sqrt(4*r*r-temp*temp));
                    }
                }
                res[i]=Math.max(res[i],r);
            }
            for(int i=0;i<n;i++){
                pw.print(res[i]+" ");
            }
            pw.flush();
        }
    }
}
class FastScanner{
    BufferedReader br;
    StringTokenizer st;
    FastScanner(){
        br=new BufferedReader(new InputStreamReader(System.in));
        st=new StringTokenizer("");
    }

    String nextLine(){
        String s="";
        try {
            s=br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }
    boolean hasNext(){
        String s="";
        while(!st.hasMoreTokens()){
            s=nextLine();
            if(s==null)return false;
            st=new StringTokenizer(s);
        }
        return true;
    }
    String next(){
        String s="";
        while(!st.hasMoreTokens()){
            s=nextLine();
            st=new StringTokenizer(s);
        }
        return st.nextToken();
    }
    int nextInt(){
        return Integer.valueOf(next());
    }
    long nextLong(){
        return Long.valueOf(next());
    }
    double nextDouble(){
        return Double.valueOf(next());
    }
}


import java.io.*;
import java.util.*;

public class Main {

	public static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	public static void main(String[] args) {
		// InputStream inputStream = System.in; // Useful when taking input other than
		// console eg file handling // check ctor of inputReader
		InputReader scn = new InputReader();

		int n = scn.nextInt(), r = scn.nextInt();
		double[] y = new double[n];
		int[] x = new int[n];
		boolean[] mark = new boolean[n];
		for(int i = 0; i < n; i++) {
			x[i] = scn.nextInt();
		}
		for(int i = 0; i < n; i++) {
			double yc = r;
			for(int j = 0; j < n; j++) {
				if(i == j || !mark[j]) {
					continue;
				}
				if(x[i] + r < x[j] - r || x[i] - r > x[j] + r) {
					continue;
				}

				yc = Math.max(yc, y[j] + Math.sqrt(Math.abs(Math.pow(x[i] - x[j], 2) - 4 * r * r)));
			}
			y[i] = yc;
			mark[i] = true;
		}

		for(int i = 0; i < n; i++) {
			System.out.print(y[i] + " ");
		}
		System.out.println();
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class C {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int r = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++)
			arr[i] = sc.nextInt();

		double[] ans = new double[n];

		for (int i = 0; i < n; i++) {
			double max = 0;
			for (int j = 0; j < i; j++) {
				int difx = Math.abs(arr[i] - arr[j]);
				if (difx <= 2 * r) {
					max = Math.max(max, ans[j] + Math.sqrt(4 * r * r - difx * difx));
				}
			}
			ans[i] = max;
		}
		PrintWriter pw = new PrintWriter(System.out);
		for (int i = 0; i < n; i++)
			pw.print(ans[i] + r + " ");
		pw.flush();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}
}


import java.util.*;

import java.io.*;
import java.lang.reflect.Array;

public class C {
	FastScanner in;
	PrintWriter out;
	boolean systemIO = true;

	public static class Pair {
		int x;
		int y;

		public Pair(int x, int y) {
			this.x = x;
			this.y = y;
		}
	}

	public void solve() {
		int n = in.nextInt();
		int r = 2 * in.nextInt();
		int[] x = new int[n];
		for (int i = 0; i < x.length; i++) {
			x[i] = in.nextInt();
		}
		double[] y = new double[n];
		for (int i = 0; i < y.length; i++) {
			y[i] = r / 2;
		}
		for (int i = 0; i < y.length; i++) {
			for (int j = 0; j < i; j++) {
				if (Math.abs(x[i] - x[j]) == r) {
					y[i] = Math.max(y[i], y[j]);
				} else if (Math.abs(x[i] - x[j]) < r) {
					y[i] = Math.max(y[i], y[j] + Math.sqrt(r * r - (x[j] - x[i]) * (x[j] - x[i])));
				}
			}
		}
		for (int i = 0; i < y.length; i++) {
			out.print(y[i] + " ");
		}
	}

	public void run() {
		try {
			if (systemIO) {
				in = new FastScanner(System.in);
				out = new PrintWriter(System.out);
			} else {
				in = new FastScanner(new File("segments.in"));
				out = new PrintWriter(new File("segments.out"));
			}
			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				return null;
			}
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

	}

	// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
	public static void main(String[] arg) {
		new C().run();
	}
}


import java.util.*;
import java.io.*;
import java.math.*;

public class C{

	static int n;
	static double sqr(double v) {return (v*v);}
	static double sqrt(double v) {return Math.sqrt(v);}
	static double r,x[],res[];
	static void MainMethod()throws Exception{
		n=reader.nextInt();
		r=reader.nextDouble();
		int i,j;
		x=new double[n];
		res=new double[n];
		for (i=0;i<n;i++)x[i]=reader.nextDouble();
		res[0]=r;
		for (i=1;i<n;i++) {
			res[i]=r;
			for (j=0;j<i;j++) {
				if (Math.abs(x[i]-x[j])<=(2*r)) {
					res[i]=Math.max(res[i],
							sqrt(sqr(2*r)-sqr(x[i]-x[j]))+res[j]
							);
				}
			}
		}
		for (i=0;i<n;i++)
			printer.print(res[i]+" ");
	}
	public static void main(String[] args)throws Exception{
		MainMethod();
		printer.close();
	}
	static void halt(){
		printer.close();
		System.exit(0);
	}
	static PrintWriter printer=new PrintWriter(new OutputStreamWriter(System.out));
	static class reader{
		static BufferedReader bReader=new BufferedReader(new InputStreamReader(System.in));
		static StringTokenizer token=new StringTokenizer("");
		static String readNextLine() throws Exception{
			return bReader.readLine();
		}
		static String next() throws Exception{
			while (token.hasMoreTokens()==false){
				token=new StringTokenizer(bReader.readLine());
			}
			return token.nextToken();
		}
		static int nextInt()throws Exception{
			while (token.hasMoreTokens()==false){
				token=new StringTokenizer(bReader.readLine());
			}
			return Integer.parseInt(token.nextToken());
		}
		static long nextLong()throws Exception{
			while (token.hasMoreTokens()==false){
				token=new StringTokenizer(bReader.readLine());
			}
			return Long.parseLong(token.nextToken());
		}
		static double nextDouble()throws Exception{
			while (token.hasMoreTokens()==false){
				token=new StringTokenizer(bReader.readLine());
			}
			return Double.parseDouble(token.nextToken());
		}
	}
	static class MyMathCompute{
		static long [][] MatrixMultiplyMatrix(long [][] A, long [][] B, long mod) throws Exception{
			int n=A.length, m=B[0].length;
			int p=A[0].length;
			int i,j,k;
			if (B.length!=p) throw new Exception("invalid matrix input");
			long [][] res=new long [n][m];
			for (i=0;i<n;i++) for (j=0;j<m;j++){
				if (A[i].length!=p) throw new Exception("invalid matrix input");
				res[i][j]=0;
				for (k=0;k<p;k++)
					res[i][j]=(res[i][j]+((A[i][k]*B[k][j])% mod))% mod;
			}
			return res;
		}
		static double [][] MatrixMultiplyMatrix(double [][] A, double [][] B ) throws Exception{
			int n=A.length, m=B[0].length;
			int p=A[0].length;
			int i,j,k;
			if (B.length!=p) throw new Exception("invalid matrix input");
			double [][] res=new double [n][m];
			for (i=0;i<n;i++) for (j=0;j<m;j++){
				if (A[i].length!=p) throw new Exception("invalid matrix input");
				res[i][j]=0;
				for (k=0;k<p;k++)
					res[i][j]=res[i][j]+(A[i][k]*B[k][j]);
			}
			return res;
		}
		static long [][] MatrixPow(long [][] A,long n, long mod) throws Exception{
			if (n==1) return A;
			long [][] res=MatrixPow(A, n/2, mod);
			res=MatrixMultiplyMatrix(res, res, mod);
			if ((n % 2) == 1) res=MatrixMultiplyMatrix(A,res, mod);
			return res;
		}
		static double [][] MatrixPow(double [][] A,long n) throws Exception{
			if (n==1) return A;
			double[][] res=MatrixPow(A, n/2);
			res=MatrixMultiplyMatrix(res, res);
			if ((n % 2) == 1) res=MatrixMultiplyMatrix(A,res);
			return res;
		}
		static long pow(long a,long n,long mod){
			a= a % mod;
			if (n==0) return 1;
			long k=pow(a,n/2,mod);
			if ((n % 2)==0) return ((k*k)%mod);
			else return (((k*k) % mod)*a) % mod;
		}
		static double pow(double a,long n){
			if (n==0) return 1;
			double k=pow(a,n/2);
			if ((n % 2)==0) return (k*k);
			else return (((k*k) )*a) ;
		}
	}
}


import java.util.*;
import java.io.*;
import java.math.*;
public class Solution{
    public static void main(String[] args) throws Exception {
        int n=nextInt();
        int r=nextInt();
        int x[]=new int[n];
        double y[]=new double[n];
        for(int i=0;i<n;i++)
            x[i]=nextInt();
        for(int i=0;i<n;i++){
            //(x1-x2)2+(y1-y2)2=r2
            y[i]=r;
            for(int j=0;j<i;j++){
                int d=sq(2*r)-sq(x[i]-x[j]);
                if(d>=0){
                    double y1=Math.sqrt(d)+y[j];
                    y[i]=Math.max(y1,y[i]);
                }
            }
        }
        for(int i=0;i<n;i++)
            System.out.printf("%.12g ",y[i]);
    }
    static int sq(int a){
        return a*a;
    }
    static int nextInt()throws IOException{
        InputStream in=System.in;
        int ans=0;
        boolean flag=true;
        byte b=0;
        while ((b>47 && b<58) || flag){
            if(b>=48 && b<58){
                ans=ans*10+(b-48);
                flag=false;
            }
            b=(byte)in.read();
        }
        return ans;
    }
    static String next()throws Exception{
        StringBuilder sb=new StringBuilder(1<<16);
        InputStream in=System.in;
        byte b=0;
        do{
            if(!isWhiteSpace(b))
                sb.append((char)b);
            b=(byte)in.read();
        }while(!isWhiteSpace(b) || sb.length()==0);
        return sb.toString();
    }
    static boolean isWhiteSpace(byte b){
        char ch=(char)b;
        return ch=='\0' || ch==' ' || ch=='\n';
    }
}


import java.io.*;
import java.math.*;
import java.util.*;
public class Main{
  public static void main(String[] args){
    InputReader reader = new InputReader(System.in);
    PrintWriter pw = new PrintWriter(System.out);
    int n = reader.nextInt();
    int r = reader.nextInt();
    int[] x = new int[n];
    double[] y = new double[n];

    for(int i=0;i<n;++i){
      int iniX = reader.nextInt();
      double bestY = (double)r;
      for(int j=0;j<i;++j){
//         pw.printf("testing %d %d\n", i, j);
        if(Math.abs(iniX - x[j]) < 2*r){
//           pw.printf("on colision %d %d\n", i, j);
          bestY = Math.max(bestY, collisionY((double)x[j], y[j], (double)iniX, r));
        }
        if(Math.abs(iniX - x[j]) == 2*r){
//           pw.printf("touvhing %d %d\n", i, j);
          bestY = Math.max(bestY, y[j]);
        }
      }
      x[i] = iniX;
      y[i] = bestY;
    }
    for(int i=0;i<n;++i){
      pw.printf("%.9f ", y[i]);
    }
    pw.flush();
    pw.close();
  }

  public static double collisionY(double x1, double y1, double x2, double r){
    double dhsq = r*r*4-(x1-x2)*(x1-x2);
    return y1+Math.sqrt(dhsq);
  }

  public static class InputReader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    public InputReader (InputStream stream){
      reader = new BufferedReader(new InputStreamReader(stream));
    }

    public String next(){
      while(tokenizer == null || !tokenizer.hasMoreTokens()){
        try{
          String line = reader.readLine();
          if(line == null){
            return "0";
          }
          tokenizer = new StringTokenizer(line);
        } catch(IOException ioe){
          throw new RuntimeException(ioe);
        }
      }
      return tokenizer.nextToken();
    }

    public int nextInt(){
      return Integer.parseInt(next());
    }

    public double nextDouble(){
      return Double.parseDouble(next());
    }

    public Long nextLong(){
      return Long.parseLong(next());
    }

    public BigInteger nextBigInteger(){
      return new BigInteger(next());
    }

    public String nextLine(){
      String line = "";
      try{
        while(line.equals("")){
          line = reader.readLine();
        }
      } catch(IOException ioe){
        throw new RuntimeException(ioe);
      }
      return line;
    }
  }

  public static class MultiSet<E> {
    HashMap<E, Integer> map = new HashMap<E, Integer>();
    int multiSize = 0;
    public int add(E key){
      multiSize ++;
      Integer amount = map.get(key);
      if(amount == null){
        map.put(key, 1);
        return 1;
      }
      map.put(key, amount+1);
      return amount+1;
    }

    public int remove(E key){
      Integer amount = map.get(key);
      if(amount == null){
        return -1;
      }
      multiSize --;
      if(amount == 1){
        map.remove(key);
      } else {
        map.put(key, amount-1);
      }
      return amount-1;
    }

    public ArrayList<E> elems(){
      ArrayList<E> ret = new ArrayList<E>(multiSize);
      for(Map.Entry<E, Integer> e : map.entrySet()){
        E key = e.getKey();
        int v = e.getValue();
        while(v-->0){
          ret.add(key);
        }
      }
      return ret;
    }

    public int getMultiSize(){
      return multiSize;
    }

  }

   public static class MaxBIT{
    int n;
    int[]t;

    public MaxBIT(int n){
      this.n = Integer.highestOneBit(n)<<1;
      this.t = new int[this.n<<1];
      for(int i=0;i<2*this.n;++i){
        t[i] = -1;
      }
    }

    public void setMax(int p, int val){
      p+=n;
      while(p>1){
        t[p] = Math.max(t[p], val);
        p>>=1;
      }
    }

    public int getMax(int p, int q){
      p+=n;
      q+=n;
      int ret = -1;
      while(p<q){
        if((p&1)==1){
          ret=Math.max(t[p++], ret);
        }
        if((q&1)==1){
          ret=Math.max(t[--q], ret);
        }
        p = p>>1;
        q = q>>1;
      }
      return ret;
    }
  }

}


import java.awt.geom.Point2D;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class C {
	public static void main(String[] args) throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String[] line = in.readLine().split(" ");
		int n = Integer.parseInt(line[0]);
		int r=  Integer.parseInt(line[1]);
		line = in.readLine().split(" ");
		double[] x = new double[n];
		double[] y= new double[n];
		for(int i = 0; i<n; i++) {
			y[i] = r;
			x[i] = Integer.parseInt(line[i]);
		}
		for(int i = 1; i<n; i++) {
			for(int j = 0; j<i; j++) {
				if(Math.abs(x[i]-x[j])>r*2) {
					continue;
				}
				double low = y[j];
				double high = y[j]+(double)r*2.0;
				for(int k = 0; k<85 && low<high; k++) {
					double mid = (low+high)/2.0;
					if(Point2D.distance(x[j], y[j], x[i], mid)<(double)r*2.0) {
						low = mid;
					}
					else {
						high = mid;
					}
				}
				y[i] = Math.max(y[i], low);
			}
		}
		System.out.printf("%.15f",y[0]);
		for(int i = 1; i<n; i++) {
			System.out.printf(" %.15f",y[i]);
		}
		System.out.print("\n");
	}
}


import java.io.*;
import java.util.*;
import java.math.*;

public class utkarsh {

    InputStream is;
    PrintWriter out;

    double x[], y[], R;

    boolean game(double x1, double y1, double x2, double y2){
        double dis = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
        //if(x2 == 12 && x1 == 8 && y1 > 13 && y1 < 14)    out.println(dis +" "+ y2);
        return dis <= 4.0 * R * R;
    }

    void play(int n){
        double l, r, m;
        double a[] = new double[n];
        for(int i = 0; i < n; i++){
            l = 0.0;
            r = 1000000.0;
            for(int j = 0; j < 50; j++){
                m = (l + r) / 2;
                if(game(x[i], 0, x[n], m))  l = m;
                else    r = m;
            }
            a[i] = l;
        }
        for(int i = 0; i < n; i++){
            //if(n == 4)  out.println(a[i] +" "+ y[i]);
            if(a[i] > 0.0 && (y[i] + a[i]) > y[n])    y[n] = y[i] + a[i];
        }
    }

    void solve(){
        //Enter code here utkarsh
        int i, j, n;
        n = ni();
        R = nd();
        x = new double[n];
        y = new double[n];
        for(i = 0; i < n; i++)  x[i] = nd();
        for(i = 0; i < n; i++){
            play(i);
        }
        for(i = 0; i < n; i++)  out.print((R + y[i]) +" ");
    }

    public static void main(String[] args) { new utkarsh().run();
    }
    void run(){ is = System.in; out = new PrintWriter(System.out); solve(); out.flush();
    }

    byte input[] = new byte[1024];
    int len = 0, ptr = 0;

    int readByte(){ if(ptr >= len){ ptr = 0; try{ len = is.read(input); }catch(IOException e){ throw new InputMismatchException(); } if(len <= 0){ return -1; } } return input[ptr++];
    }
    boolean isSpaceChar(int c){ return !( c >= 33 && c <= 126 );
    }
    int skip(){ int b = readByte(); while(b != -1 && isSpaceChar(b)){ b = readByte(); } return b;
    }

    char nc(){ return (char)skip();
    }
    String ns(){ int b = skip(); StringBuilder sb = new StringBuilder(); while(!isSpaceChar(b)){ sb.appendCodePoint(b); b=readByte(); } return sb.toString();
    }
    int ni(){ int n = 0,b = readByte(); boolean minus = false; while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')){ b = readByte(); } if(b == '-'){ minus = true; b = readByte(); } if(b == -1){ return -1; } while(b >= '0' && b <= '9'){ n = n * 10 + (b - '0'); b = readByte(); } return minus ? -n : n;
    }
    long nl(){ long n = 0L; int b = readByte(); boolean minus = false; while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')){ b = readByte(); } if(b == '-'){ minus = true; b = readByte(); } while(b >= '0' && b <= '9'){ n = n * 10 + (b - '0'); b = readByte(); } return minus ? -n : n;
    }
    double nd(){ return Double.parseDouble(ns());
    }
    float nf(){ return Float.parseFloat(ns());
    }
    int[] na(int n){ int a[] = new int[n]; for(int i = 0; i < n; i++){ a[i] = ni(); } return a;
    }
    char[] ns(int n){ char c[] = new char[n]; int i,b = skip(); for(i = 0; i < n; i++){ if(isSpaceChar(b)){ break; } c[i] = (char)b; b = readByte(); } return i == n ? c : Arrays.copyOf(c,i);
    }
}


import java.io.*;
import java.util.*;
import java.math.*;
// import java.awt.Point;

public class Main {
    InputStream is;
    PrintWriter out;
    String INPUT = "";

    long MOD = 1_000_000_007;
    int inf = Integer.MAX_VALUE;

    void solve(){
        int n = ni();
        int r = ni();
        int[] x = new int[n];
        for(int i = 0; i < n; i++){
            x[i] = ni();
        }
        double[] y = new double[n];
        Arrays.fill(y,-1);
        for(int i = 0; i < n; i++){
            for(int j = 0; j < i; j++){
                double res = 4*r*r - (x[i]-x[j])*(x[i]-x[j]);
                if(res < 0) continue;
                else{
                    double tmp = Math.sqrt(res) + y[j];
                    if(tmp > y[i]){
                        y[i] = tmp;
                    }
                }
            }
            if(y[i]==-1) y[i] = r;
        }
        for(int i = 0; i < n; i++){
            out.print(y[i]+" ");
        }
    }

    class Permutation{
    // max=10
    // n=10: 160ms
    // n=11: 1600-1700ms
    int n;
    int max;
    BitSet used;
    int[] p;
    public Permutation(int n, int max){
        this.n = n;
        this.max = max;
        used = new BitSet(n);
        p = new int[n];
    }

    public boolean next(){
        if(used.cardinality() == 0){
            for(int i=0; i<n; i++){
                p[i] = i;
            }
            used.set(0, n);
            return true;
        }
        int i;
        for(i=n-1; i>=0; i--){
            used.clear(p[i]);
            if((used.nextClearBit(p[i]+1)) < max) break;
        }
        if(i<0) return false;
        p[i] = used.nextClearBit(p[i]+1);
        used.set(p[i]);
        int idx = i+1;
        for(i=used.nextClearBit(0); i<max && idx<n; i=used.nextClearBit(i+1)){
            p[idx++] = i;
            used.set(i);
        }
        return true;
    }

    public String toString(){
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<n; i++){
            sb.append(p[i]+" ");
        }
        return sb.toString();
    }
}
    void run() throws Exception
    {
        is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        out = new PrintWriter(System.out);

        long s = System.currentTimeMillis();
        solve();
        out.flush();
        if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
    }

    public static void main(String[] args) throws Exception { new Main().run(); }

    private byte[] inbuf = new byte[1024];
    private int lenbuf = 0, ptrbuf = 0;

    private int readByte()
    {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    private double nd() { return Double.parseDouble(ns()); }
    private char nc() { return (char)skip(); }

    private String ns()
    {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b) && b != ' ')){
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n)
    {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m)
    {
        char[][] map = new char[n][];
        for(int i = 0;i < n;i++)map[i] = ns(m);
        return map;
    }

    private int[] na(int n)
    {
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }

    private int ni()
    {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl()
    {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }

}


import java.util.*;
import java.io.*;

public class NewYearAndCurling {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		StringTokenizer t = new StringTokenizer(in.readLine());
		int N = Integer.parseInt(t.nextToken());
		int R = Integer.parseInt(t.nextToken());
		int[] x = new int[N];
		t = new StringTokenizer(in.readLine());
		for(int i = 0; i < N; ++i)
			x[i] = Integer.parseInt(t.nextToken());
		double[] y = new double[N];
		for(int i = 0; i < N; ++i) {
			double max = R;
			for(int j = 0; j < i; ++j ) {
				int xDiff = Math.abs(x[i] - x[j]);
				if(xDiff <= 2 * R)
					max = Math.max(max, y[j] + Math.sqrt(4*R*R - xDiff*xDiff));
			}
			y[i] = max;
		}
		out.print(y[0]);
		for(int i = 1; i < N; ++i)
			out.print(" " + y[i]);
		out.println();
		in.close();
		out.close();
	}
}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.*;
import java.util.*;

/**
 *
 * @author kamranmaharov
 */
public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

        String[] line = in.readLine().split(" ");
        int n = Integer.parseInt(line[0]);
        int r = Integer.parseInt(line[1]);

        line = in.readLine().split(" ");
        int[] x = new int[n+1];
        double[] y = new double[n+1];

        for (int i=1; i<=n; ++i) {
            x[i] = Integer.parseInt(line[i-1]);
            double maxy = -1.0;
            for (int j=1; j<i; ++j) {
                double x2 = x[i];
                double x1 = x[j];
                double y1 = y[j];

                double a = 1;
                double b = -2 * y1;
                double c = x1 * x1 + x2 * x2 - 2 * x1 * x2 + y1 * y1 - 4.0 * r * r;

                double D = b * b - 4 * a * c;
                //System.out.println(i + " " + j + " " + D);
                if (D >= 0) {
                    double y2 = (-b + Math.sqrt(D)) / (2 * a);
                    maxy = Math.max(maxy, y2);
                }
            }
            if (maxy < 0) {
                maxy = r;
            }
            y[i] = maxy;
            if (i>1) {System.out.print(" ");}
            System.out.printf("%.13f", y[i]);
        }
        System.out.println();
    }
}


import java.io.*;
import java.util.StringTokenizer;

public class Main {
	public static String taskName = "";

	public class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int n = in.nextInt();
			int r = in.nextInt();
			int[] x = new int[n];
			for(int i = 0; i < n; i++)
				x[i] = in.nextInt();

			double[] y = new double[n];
			for(int i = 0; i < n; i++) {
				y[i] = r;
				for(int j = 0; j < i; j++) {
					int dx = Math.abs(x[i] - x[j]);
					if(dx <= 2 * r)
						y[i] = Math.max(y[i], y[j] + Math.abs(Math.sqrt(4 * r * r - dx * dx)));
				}
				System.out.print(y[i] + " ");
			}

			System.out.println();
		}
	}

	public static void main(String[] args) throws FileNotFoundException {
		if(!taskName.isEmpty()) {
			System.setIn(new BufferedInputStream(new FileInputStream(taskName + ".in")));
			System.setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream(taskName + ".out"))));
		}
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Main main = new Main();
		main.run(in, out);
		out.close();
	}

	public void run(InputReader in, PrintWriter out) {
		Task solver = new Task();
		solver.solve(1, in, out);
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while(tokenizer == null || !tokenizer.hasMoreTokens())
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch(IOException e) {
					throw new RuntimeException(e);
				}
			return tokenizer.nextToken();
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public double nextShort() {
			return Short.parseShort(next());
		}

		public double nextByte() {
			return Byte.parseByte(next());
		}

		public double nextFloat() {
			return Float.parseFloat(next());
		}
	}
}


import java.util.*;
public class C {

	public static void main(String[] args) {
		Scanner qwe = new Scanner(System.in);
		int n = qwe.nextInt();
		double r = qwe.nextDouble();

		double[] fy = new double[n];
		Arrays.fill(fy, r);

		double[] xs = new double[n];
		for (int i = 0; i < xs.length; i++) {
			xs[i] = qwe.nextDouble();
		}

		for(int i =0; i < n; i++){

			for(int j = i+1; j < n; j++){
				double dx = xs[j]-xs[i];
				if(Math.abs(dx) > 2*r) continue;
				fy[j] = Math.max(fy[j], Math.sqrt(4*r*r-dx*dx)+fy[i]);
			}

		}

		StringBuilder stb = new StringBuilder();
		for (int i = 0; i < xs.length; i++) {
			stb.append(fy[i]+" ");
		}
		System.out.println(stb);
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
import java.util.StringTokenizer;

import java.util.*;
import static java.lang.Math.*;

public class ProblemC {
	public static void main(String[] args) {
		FastScanner input = new FastScanner();
		int n = input.nextInt();
		int radius = input.nextInt();
		ArrayList<Integer> diskXToFall = new ArrayList<Integer>();
		for (int a = 0; a < n; a++) {
			diskXToFall.add(input.nextInt());
		}
		ArrayList<P> stationaryDisks = new ArrayList<P>();
		for (int a = 0; a < n; a++) {
			double highCollision = radius;
			for (P i : stationaryDisks) {
				if (Math.abs(diskXToFall.get(a) - i.x) - 1e-8 <= 2 * radius) {
					double hypot = 2 * radius;
					double leg = Math.abs(diskXToFall.get(a) - i.x);
					double yOffset = Math.sqrt(Math.abs(hypot * hypot - leg * leg));
					highCollision = Math.max(highCollision, yOffset + i.y);
				}
			}
			stationaryDisks.add(new P(diskXToFall.get(a), highCollision));
		}
		for(int a = 0; a < n; a++) {
			System.out.print(stationaryDisks.get(a).y + " ");
		}

	}

	static class P implements Comparable<P> {
		final double x, y;

		P(double x, double y) {
			this.x = x;
			this.y = y;
		}

		P sub(P that) {
			return new P(x - that.x, y - that.y);
		}

		P add(P that) {
			return new P(x + that.x, y + that.y);
		}

		double dot(P that) {
			return x * that.x + y * that.y;
		}

		P scale(double s) {
			return new P(x * s, y * s);
		}

		// Use hypot() only if intermediate overflow must be avoided; very slow
		double length() {
			return sqrt(x * x + y * y);
		}

		double length2() {
			return x * x + y * y;
		}

		P leftNormal() {
			return new P(-y, x);
		} // rotateCCW(90deg)

		P rightNormal() {
			return new P(y, -x);
		} // rotateCW(90deg)

		P normalize() {
			double n = length();
			return n > 0 ? new P(x / n, y / n) : origin();
		}

		P scaleToLength(double l) {
			return normalize().scale(l);
		}

		P project(P a) {
			return scale(a.dot(this) / length2());
		}

		P reflect(P a) {
			return project(a).scale(2.0).sub(a);
		}

		// use if sin, cos are known
		P rotateCCW(double sinT, double cosT) {
			return new P(x * cosT - y * sinT, x * sinT + y * cosT);
		}

		P rotateCW(double sinT, double cosT) {
			return rotateCCW(-sinT, cosT);
		}

		P rotate(double theta) {
			return rotateCCW(sin(theta), cos(theta));
		}

		// angle to horizontal (1, 0); result is in [-pi, pi] rad or (-180-180) deg
		double theta() {
			return atan2(y, x);
		}

		// angle between two vectors, result is in [0, pi] rad (0-180 deg)
		double angleTo(P a) {
			return acos(this.dot(a) / this.length() / a.length());
		}

		boolean isOrigin() {
			return x == 0 && y == 0;
		}

		public String toString() {
			return String.format("(%f,%f)", this.x, this.y);
		}

		static P read(Scanner s) {
			return new P(s.nextDouble(), s.nextDouble());
		}

		static P origin() {
			return new P(0, 0);
		}

		double det(P that) {
			return this.x * that.y - this.y * that.x;
		}

		double crossproduct(P that) {
			return this.det(that);
		}

		P half(P q) {
			return normalize().add(q.normalize());
		}

		double dist(P to) {
			return sub(to).length();
		}

		double signedParallelogramArea(P b, P c) {
			return (b.sub(this).crossproduct(c.sub(this)));
		}

		boolean isCollinearWith(P b, P c) {
			return abs(signedParallelogramArea(b, c)) <= EPS;
		}

		// is going from this to b to c a CCW turn? Do not use if points may be
		// collinear
		boolean isCCW(P b, P c) {
			return signedParallelogramArea(b, c) > 0;
		}

		double signedTriangleArea(P b, P c) {
			return signedParallelogramArea(b, c) / 2.0;
		}

		// memory-optimized version of this.sub(to).length2() that avoids an
		// intermediate object
		double dist2(P to) {
			double dx = this.x - to.x;
			double dy = this.y - to.y;
			return dx * dx + dy * dy;
		}

		/**
		 * Compute x for a * x + b = 0 and ||x|| = C where 'this' is a. Care must be
		 * taken to handle the case where either a.x or a.y is near zero.
		 */
		P[] solveDotProductConstrainedByNorm(double b, double C) {
			P a = this;
			if (a.isOrigin())
				throw new Error("degenerate case");

			boolean transpose = abs(a.x) > abs(a.y);
			a = transpose ? new P(a.y, a.x) : a;

			Double[] x = solvequadratic(a.length2(), 2.0 * b * a.x, b * b - a.y * a.y * C * C);
			P[] p = new P[x.length];
			for (int i = 0; i < x.length; i++) {
				double x1 = x[i];
				double x2 = ((-b - a.x * x1) / a.y);
				p[i] = transpose ? new P(x2, x1) : new P(x1, x2);
			}
			return p;
		}

		@Override
		public int compareTo(P that) {
			if (abs(this.x - that.x) > EPS)
				return Double.compare(this.x, that.x);
			return Double.compare(this.y, that.y);
		}
	}

	static class HP extends P { // Hashable Point
		HP(double x, double y) {
			super(x, y);
		}

		@Override
		public int hashCode() {
			return Double.hashCode(x + 32768 * y);
		}

		@Override
		public boolean equals(Object _that) {
			HP that = (HP) _that;
			return this.x == that.x && this.y == that.y;
		}
	}

	/**
	 * Sort points by polar angle relative to center, using trig. This is a
	 * counter-clockwise sort with zero at 3 o'clock.
	 */
	static Comparator<P> makePolarAngleComparatorTrig(final P center) {
		return new Comparator<P>() {
			public int compare(P a, P b) {
				double thetaa = a.sub(center).theta();
				double thetab = b.sub(center).theta();
				if (thetaa < 0)
					thetaa += 2 * PI;
				if (thetab < 0)
					thetab += 2 * PI;
				int c = Double.compare(thetaa, thetab);
				if (c != 0)
					return c;
				return Double.compare(b.x, a.x); // arbitrary tie-breaker
			}
		};
	}

	/**
	 * Sort points by polar angle relative to center, w/o trig. This is a
	 * counter-clockwise sort with zero at 3 o'clock.
	 */
	static Comparator<P> makePolarAngleComparator(final P center) {
		return new Comparator<P>() {
			public int compare(P a, P b) {
				// orientation() requires that a and b lie in the same half-plane
				if (a.y >= center.y && b.y < center.y)
					return -1;
				if (b.y >= center.y && a.y < center.y)
					return 1;
				int orientation = (int) Math.signum(center.signedParallelogramArea(b, a));
				if (orientation != 0)
					return orientation;
				return Double.compare(b.x, a.x); // arbitrary tie-breaker
			}
		};
	}

	/*
	 * Solve a * x^2 + b * x + c == 0 Returns 0, 1, or 2 solutions. If 2 solutions
	 * x1, x2, guarantees that x1 < x2
	 */
	static Double[] solvequadratic(double a, double b, double c) {
		double D = b * b - 4 * a * c;
		if (D < -EPS)
			return new Double[] {};
		D = max(D, 0);
		if (D == 0)
			return new Double[] { -b / 2.0 / a };
		double d = sqrt(D);
		// Numerically more stable, see
		// https://en.wikipedia.org/wiki/Loss_of_significance#A_better_algorithm
		if (signum(b) == 0)
			return new Double[] { d / 2.0 / a, -d / 2.0 / a };
		double x1 = (-b - signum(b) * d) / (2 * a);
		double x2 = c / (a * x1);
		return new Double[] { Math.min(x1, x2), Math.max(x1, x2) };
	}

	/*
	 * The Line/Circle classes provide a number of methods that require dealing with
	 * floating point precision issues. Default EPS to a suitable value, such as
	 * 1e-6, which should work for many problems in which the input coordinates are
	 * in integers and subsequently inexact floating point values are being
	 * computed.
	 */
	static double EPS = 1e-6;

	/*
	 * A line denoted by two points p and q. For internal computations, we use the
	 * parametric representation of the line as p + t d where d = q - p. For
	 * convenience, we compute and store d in the constructor. Most methods hide the
	 * parametric representation of the line, but it is exposed via
	 * getPointFromParameter and intersectionParameters for those problems that need
	 * it.
	 *
	 * The line may be interpreted either as a line segment denoted by the two end
	 * points, or as the infinite line determined by these two points. Intersection
	 * methods are provided for both cases.
	 */
	static class Line {
		P p, q, d;

		Line(P p, P q) {
			this.p = p;
			this.q = q;
			d = q.sub(p);
		}

		P getPointFromParameter(double t) {
			return p.add(d.scale(t));
		}

		// reflect vector across vector (as if line originated at (0, 0))
		P reflect(P d2) {
			return d.reflect(d2);
		}

		// reflect point across (infinite) line
		P reflectPoint(P r) {
			return reflect(r.sub(p)).add(p);
		}

		// project p onto this (infinite) line. Returns point on line
		P project(P a) {
			return p.add(d.project(a.sub(p)));
		}

		// return distance of point P from this (infinite) line.
		double distance(P a) {
			return project(a).dist(a);
		}

		@Override
		public String toString() {
			return String.format("[%s => %s]", p, q);
		}

		/*
		 * Point of intersection of this line segment with another line segment. Returns
		 * only points that lie inside both line segments, else null.
		 *
		 * Result may include points "just outside" the bounds, given EPS.
		 */
		P intersectsInBounds(Line l) {
			double[] st = intersectionParameters(l);
			if (st == null)
				return null;

			// check that point of intersection is in direction 'd'
			// and within segment bounds
			double s = st[0];
			double t = st[1];
			if (s >= -EPS && s <= 1 + EPS && -EPS <= t && t <= 1 + EPS)
				return getPointFromParameter(s);

			return null;
		}

		/*
		 * Point of intersection of this (infinite) line with other (infinite) line.
		 * Return null if collinear.
		 */
		P intersects(Line l) {
			double[] st = intersectionParameters(l);
			if (st != null)
				return getPointFromParameter(st[0]);
			return null;
		}

		/*
		 * Intersect this line with that line Solves: this.p + s * this.d == l.p + t l.d
		 * Return null if lines are collinear Else returns [s, t].
		 */
		double[] intersectionParameters(Line l) {
			P dneg = p.sub(q);
			double D = l.d.det(dneg);
			// Use Cramer's rule; see text
			if (D == 0.0)
				return null;

			P rp = p.sub(l.p);
			return new double[] { l.d.det(rp) / D, rp.det(dneg) / D };
		}

		/*
		 * Compute points of intersection of this infinite line with a circle. Computes
		 * projection 'x' of c.c onto line, then computes x +/- d.scaleToLength(h) where
		 * h is computed via Pythagoras. Sorted by decreasing 't' (as would be used in
		 * getPointFromParameter)
		 *
		 * May return two points even if line is a tangent.
		 */
		P[] intersectsCircle(Circle c) {
			P x = project(c.c);
			double D = x.dist(c.c);
			// outside by more than EPS
			if (D > c.R + EPS)
				return new P[0];
			double h = sqrt(max(0, c.R * c.R - D * D));
			if (h == 0)
				return new P[] { x }; // EPS (!?)
			return new P[] { x.add(d.scaleToLength(h)), x.add(d.scaleToLength(-h)) };
		}

		/*
		 * Compute points of intersection of this infinite line with a circle.
		 *
		 * Solves a + t * b = c + r subject to ||r|| = R Returns zero, one, or two
		 * points on the periphery, e.g. c + r[0,1], sorted by decreasing 't'.
		 * Alternative version which requires solving quadratic equation.
		 *
		 * Careful: set EPS if you need to handle round-off error in discriminant.
		 */
		P[] intersectsCircleAlternative(Circle c) {
			P ca = c.c.sub(p);
			P d = q.sub(p);
			Double[] t = solvequadratic(d.length2(), -2 * d.dot(ca), ca.length2() - c.R * c.R);
			P[] r = new P[t.length];
			for (int i = 0; i < t.length; i++)
				r[i] = p.add(d.scale(t[i]));
			return r;
		}

		/**
		 * Is r contained within the line segment spanned by p/q, including their
		 * endpoints?
		 */
		boolean isInBounds(P r) {
			return abs(p.dist(q) - p.dist(r) - q.dist(r)) <= EPS;
		}

		/**
		 * Is r on the infinite line?
		 */
		boolean isOnLine(P r) {
			return r.isCollinearWith(p, q);
		}
	}

	/**
	 * Alternative line implementation using the "general form" equation.
	 *
	 * a * x + b * y + c = 0
	 *
	 * This is provided for problems in which a line may be given in general form in
	 * the input. Compared to class Line, GLine: - is shorter, particularly when
	 * only line/line and line/circle intersections are required. - does not support
	 * those functions of Line that relate to LineSegment.
	 */
	static class GLine {
		// we represent a, b as a vector to benefit from the available dot/det routines.
		P n; // n = new P(a, b) --- this is the (right) normal vector to the line
		double c;

		GLine(double a, double b, double c) {
			this.n = new P(a, b);
			if (a == 0 && b == 0)
				throw new Error("a and b cannot both be zero");
			this.c = c;
		}

		GLine(P p, P q) {
			this(p.y - q.y, q.x - p.x, p.det(q));
		}

		P intersects(GLine that) {
			double D = n.det(that.n);
			if (D == 0.0)
				return null;
			return new P((this.n.y * that.c - that.n.y * this.c) / D, (that.n.x * this.c - this.n.x * that.c) / D);
		}

		double signedDistance(P p) {
			return (n.dot(p) + c) / n.length();
		}

		double distance(P p) {
			return abs(signedDistance(p));
		}

		// checks if on (infinite) line.
		boolean isOnLine(P p) {
			return signedDistance(p) <= EPS;
		}

		// checks if on the same side, no EPS
		boolean onSameSide(P p, P q) {
			return signum(signedDistance(p)) == signum(signedDistance(q));
		}

		// angle of inclination to horizontal; result is in [0, pi] rad
		// XXX untested
		double theta() {
			double angle = atan2(n.x, -n.y);
			return angle < 0 ? (angle + PI) : angle;
		}

		// XXX untested
		boolean parallelWith(GLine that) {
			return n.det(that.n) <= EPS;
		}

		// XXX untested
		boolean perpendicularTo(GLine that) {
			return n.dot(that.n) <= EPS;
		}

		// circle-line intersection, refactored from
		// https://e-maxx-eng.appspot.com/geometry/circle-line-intersection.html
		P[] intersectsCircle(Circle C) {
			// shift line to center, this is undone by adding C.c before returning.
			double c = n.dot(C.c) + this.c;
			double n2 = n.length2();
			double r = C.R;

			P p = n.scale(-c / n2).add(C.c); // undo shift to center
			if (c * c > r * r * n2 + EPS) {
				return new P[] {};
			} else if (abs(c * c - r * r * n2) < EPS) {
				return new P[] { p };
			} else {
				double d = r * r - c * c / n2;
				double m = sqrt(d / n2);
				P q = n.rightNormal().scale(m);
				return new P[] { p.add(q), p.sub(q) };
			}
		}

		@Override
		public String toString() {
			return String.format("Line:(n=%s C=%f)", n, c);
		}
	}

	static class Circle {
		P c;
		double R;

		Circle(P c, double R) {
			this.c = c;
			this.R = R;
		}

		@Override
		public String toString() {
			return String.format("{%s, %.03f}", c, R);
		}

		/* Is this point inside the circle */
		boolean isInside(P p) {
			return R > p.dist(c) - EPS;
		}

		/* Is this point on the circle's periphery */
		boolean isOnCircle(P p) {
			return abs(p.dist(c) - R) <= EPS;
		}

		/*
		 * a line segment is outside a circle if both end points are outside and if any
		 * intersection points are outside the bounds of the line segment.
		 */
		boolean isOutside(Line l) {
			if (isInside(l.p) || isInside(l.q))
				return false;
			P[] _is = l.intersectsCircle(this);
			if (_is.length > 1)
				for (P is : _is)
					if (l.isInBounds(is))
						return false;
			return true;
		}

		/* Returns the tangent lines that the point p makes with this circle, if any. */
		Line[] tangentLines(P p) {
			// Let c +/- r be the tangent points. Then there's a 'd' such that
			// p + d - r = c
			// Since d r = 0, we multiply by r and get
			// (p - c) r - ||r|| = 0 subject to ||r|| = R
			P[] r = p.sub(c).solveDotProductConstrainedByNorm(-R * R, R);
			Line[] tangents = new Line[r.length];
			for (int i = 0; i < tangents.length; i++)
				tangents[i] = new Line(p, c.add(r[i]));
			return tangents;
		}

		/*
		 * Compute points of intersection of this circle (c1, r1) with that circle (c2,
		 * r2). Model as triangle equation m = c2 - c1 = r1 - r2 m = r1 - r2 -> m^2 =
		 * r1^2 + r2^2 - 2 r1 r2 (squaring) -> r1 r2 = (r1^2 + r2^2 - m^2)/2 and by
		 * multiplying by r1 we obtain m = r1 - r2 -> m r1 = r1^2 - r1 r2 -> m r1 = r1^2
		 * - (r1^2 + r2^2 - m^2)/2 -> m r1 + (r2^2 - r1^2 - m^2)/2 = 0 and ready for
		 * solveDotProductConstrainedByNorm
		 *
		 * Note that if the circles are (apprx) touching, this function may return 0, 1,
		 * or 2 intersection points, depending on which side of 0 the discriminant
		 * falls. You will not get NaN.
		 *
		 * If the circles coincidence (same center and radius) this will throw an
		 * 'degenerate case' error in solveDotProductConstrainedByNorm !!!
		 */
		P[] intersectsCircle(Circle that) {
			double r1 = this.R;
			double r2 = that.R;
			P m = that.c.sub(this.c);
			P[] r1sol = m.solveDotProductConstrainedByNorm((r2 * r2 - r1 * r1 - m.length2()) / 2, r1);
			// compute [c +/- r1] to obtain intersection points
			P[] is = new P[r1sol.length];
			for (int i = 0; i < r1sol.length; i++)
				is[i] = this.c.add(r1sol[i]);
			return is;
		}

		/*
		 * Shorter version of intersectsCircle that solves quadratic equation inline.
		 * Assumes there are 2 intersection points. The vector 'mid' is where the
		 * altitude of the triangle formed by the centers and the intersection point
		 * hits the line connecting the centers. Its length is e. midn is normal to it
		 * and its length is f.
		 */
		P[] intersectsCircleAlternative(Circle that) {
			P m = that.c.sub(this.c);
			double b = this.R * this.R;
			// div-by-zero if circles share center
			double e = (m.length2() + b - that.R * that.R) / 2 / m.length();
			double f = sqrt(b - e * e); // NaN if circles don't intersect
			P[] is = new P[2];
			P mid = this.c.add(m.scaleToLength(e));
			P midn = m.rightNormal();
			for (int i = 0; i < is.length; i++) {
				is[i] = mid.add(midn.scaleToLength(f));
				f *= -1;
			}
			return is;
		}

		// returns true if this circle is outside that circle
		boolean isOutside(Circle that) {
			return this.c.dist(that.c) > (this.R + that.R);
		}

		// returns true if this circle is entirely contained inside that circle
		boolean isContainedIn(Circle that) {
			// extend line from that.c to this.c by radius R
			P m = this.c.sub(that.c);
			return that.isInside(this.c.add(m.scaleToLength(this.R)));
		}

		/* Construct smallest circle that circumscribes 2 points a and b. */
		static Circle getCircumCircle(P a, P b) {
			P c = a.add(b).scale(.5);
			return new Circle(c, c.dist(a));
		}

		/* Construct circle circumscribed by 3 points a, b, c */
		static Circle getCircumCircle(P a, P b, P c) {
			P B = b.sub(a);
			P C = c.sub(a);
			double d = 2 * B.crossproduct(C);
			if (abs(d) < EPS) // points are collinear
				return getCircumCircle(new P(min(a.x, min(b.x, c.x)), min(a.y, min(b.y, c.y))),
						new P(max(a.x, max(b.x, c.x)), max(a.y, max(b.y, c.y))));

			double z1 = B.length2();
			double z2 = C.length2();
			P cc = new P(C.y * z1 - B.y * z2, B.x * z2 - C.x * z1).scale(1.0 / d);
			return new Circle(cc.add(a), cc.length());
		}

		/*
		 * Find minimum enclosing circle for a set of points. Peter, we need a source
		 * for this algorithm and its expected complexity.
		 */
		static Circle minEnclosingCircle(P[] p) {
			if (p.length == 0)
				return new Circle(new P(0, 0), 0);
			if (p.length == 1)
				return new Circle(p[0], 0);
			Collections.shuffle(Arrays.asList(p));
			Circle circle = getCircumCircle(p[0], p[1]);
			for (int i = 2; i < p.length; i++) {
				if (!circle.isInside(p[i])) {
					circle = getCircumCircle(p[0], p[i]);
					for (int j = 1; j < i; j++) {
						if (!circle.isInside(p[j])) {
							circle = getCircumCircle(p[j], p[i]);
							for (int k = 0; k < j; k++) {
								if (!circle.isInside(p[k])) {
									circle = getCircumCircle(p[i], p[j], p[k]);
								}
							}
						}
					}
				}
			}
			return circle;
		}
	}

	/**
	 * Some basic operations on Polygons.
	 */
	static class Polygon {
		P[] p; // open form, p[0] connects to p[n-1]

		// Constructors clone original array/collection
		Polygon(Collection<P> c) {
			this.p = c.toArray(new P[c.size()]);
		}

		Polygon(P[] p) {
			this.p = (P[]) p.clone();
		}

		/* Absolute of signed triangle areas */
		double signedArea() {
			double area = 0.0;
			for (int i = 0; i < p.length; i++) {
				area += p[i].det(p[(i + 1) % p.length]);
			}
			return area / 2.0;
		}

		double absoluteArea() {
			return abs(signedArea());
		}

		/*
		 * Returns an P[] array representing an open shape that is the convex hull of
		 * the given array of points, or null if less than 2 points were given.
		 */
		public Polygon convexHull() {
			if (p.length < 2)
				return null;

			// (0) find the lowest point, breaking ties to the right
			final P min = Collections.min(Arrays.asList(p), new Comparator<P>() {
				public int compare(P p1, P p2) {
					int y = Double.valueOf(p1.y).compareTo(p2.y);
					return y != 0 ? y : Double.valueOf(p1.x).compareTo(p2.x);
				}
			});

			// (1) sort points by angle from pivot
			Arrays.sort(p, new Comparator<P>() {
				public int compare(P p1, P p2) {
					double o = min.signedParallelogramArea(p1, p2); // crossproduct
					if (o != 0)
						return -(int) Math.signum(o);

					// if collinear, use distance to break tie
					return Double.valueOf(min.dist(p1)).compareTo(min.dist(p2));
				}
			});

			// (3) create stack
			Stack<P> hull = new Stack<P>();
			assert p[0] == min;
			hull.push(p[0]);
			hull.push(p[1]);

			// (4) select points that maintain left turns
			for (int i = 2; i < p.length; i++) {
				P next = p[i];
				while (hull.size() >= 2) {
					P snd = hull.get(hull.size() - 2);
					P top = hull.peek();
					if (snd.isCCW(top, next)) // keep
						break;

					hull.pop(); // discard
				}
				// keep current point
				hull.push(next);
			}
			return new Polygon(hull);
		}

		/*
		 * "Point-in-Polygon" PIP tests. Return true if point is contained in this
		 * polygon
		 *
		 * All of these tests may return 0 or 1 for points on the boundary. A separate
		 * test is required to determine if a point is on the boundary.
		 */
		public boolean contains(P q) {
			return contains_WN(q);
		}

		/*
		 * Crossing-number based algorith due to Wm. Randolph Franklin. Works only for
		 * simple polygons.
		 */
		private boolean contains_CN(P q) {
			boolean c = false;
			for (int i = 0, j = p.length - 1; i < p.length; j = i++) {
				if ((((p[i].y <= q.y) && (q.y < p[j].y)) || ((p[j].y <= q.y) && (q.y < p[i].y)))
						&& (q.x < (p[j].x - p[i].x) * (q.y - p[i].y) / (p[j].y - p[i].y) + p[i].x))
					c = !c;
			}
			return c;
		}

		/*
		 * Winding numbers based algorithm, which also works for self-intersecting
		 * polygons. http://geomalgorithms.com/a03-_inclusion.html describes this as the
		 * always preferred algorithm.
		 *
		 * Return: wn = the winding number (=0 only when P is outside)
		 */
		public boolean contains_WN(P q) {
			int wn = 0; // the winding number counter

			// loop through all edges of the polygon
			int n = p.length;
			for (int i = 0; i < n; i++) { // edge from V[i] to V[i+1]
				P p = this.p[i], pn = this.p[(i + 1) % n];
				if (p.y <= q.y) { // start y <= P.y
					if (pn.y > q.y) // an upward crossing
						if (p.isCCW(pn, q)) // P left of edge
							++wn; // have a valid up intersect
				} else { // start y > P.y (no test needed)
					if (pn.y <= q.y) // a downward crossing
						if (!p.isCCW(pn, q)) // P right of edge
							--wn; // have a valid down intersect
				}
			}
			return wn != 0;
		}

		/**
		 * Is q on the boundary of this polygon?
		 */
		public boolean onBoundary(P q) {
			int n = p.length;
			for (int i = 0; i < n; i++) {
				P pi = this.p[i], pj = this.p[(i + 1) % n];
				if (new Line(pi, pj).isInBounds(q))
					return true;
			}
			return false;
		}

		@Override
		public String toString() {
			return Arrays.toString(p);
		}
	}

	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(Reader in) {
			br = new BufferedReader(in);
		}

		public FastScanner() {
			this(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String readNextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		int[] readIntArray(int n) {
			int[] a = new int[n];
			for (int idx = 0; idx < n; idx++) {
				a[idx] = nextInt();
			}
			return a;
		}

		long[] readLongArray(int n) {
			long[] a = new long[n];
			for (int idx = 0; idx < n; idx++) {
				a[idx] = nextLong();
			}
			return a;
		}
	}
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/*
 public class _908C {

 }

 */
public class _908C {
  public void solve() throws FileNotFoundException {
    InputStream inputStream = System.in;

    InputHelper in = new InputHelper(inputStream);

    // actual solution
    int n = in.readInteger();
    double r = in.readInteger();

    double[] x = new double[n];

    for (int i = 0; i < n; i++) {
      x[i] = in.readInteger();
    }

    double[] ans = new double[n];

    ans[0] = r;

    for (int i = 1; i < n; i++) {
      double cans = r;
      for (int j = 0; j < i; j++) {
        double dis = Math.abs(x[j] - x[i]);

        if (dis <= 2 * r) {

          if (dis == 2 * r) {
            cans = Math.max(cans, ans[j]);
            continue;
          } else if (x[i] == x[j]) {
            cans = Math.max(cans, ans[j] + 2 * r);
            continue;
          }
          cans = Math.max(cans, ans[j] + Math.sqrt((4 * (r * r)) - dis * dis));
        }
      }

      ans[i] = cans;
    }

    for (int i = 0; i < n; i++) {
      System.out.print(ans[i] + " ");
    }

    // end here
  }

  public static void main(String[] args) throws FileNotFoundException {
    (new _908C()).solve();
  }

  class InputHelper {
    StringTokenizer tokenizer = null;
    private BufferedReader bufferedReader;

    public InputHelper(InputStream inputStream) {
      InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
      bufferedReader = new BufferedReader(inputStreamReader, 16384);
    }

    public String read() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          String line = bufferedReader.readLine();
          if (line == null) {
            return null;
          }
          tokenizer = new StringTokenizer(line);
        } catch (IOException e) {
          e.printStackTrace();
        }
      }

      return tokenizer.nextToken();
    }

    public Integer readInteger() {
      return Integer.parseInt(read());
    }

    public Long readLong() {
      return Long.parseLong(read());
    }
  }
}