Problem: You are given a sequence of n integers a1, a2, ..., an. 

Determine a real number x such that the weakness of the sequence a1 - x, a2 - x, ..., an - x is as small as possible.

The weakness of a sequence is defined as the maximum value of the poorness over all segments (contiguous subsequences) of a sequence.

The poorness of a segment is defined as the absolute value of sum of the elements of segment.

Input

The first line contains one integer n (1 ≤ n ≤ 200 000), the length of a sequence.

The second line contains n integers a1, a2, ..., an (|ai| ≤ 10 000).

Output

Output a real number denoting the minimum possible weakness of a1 - x, a2 - x, ..., an - x. Your answer will be considered correct if its relative or absolute error doesn't exceed 10 - 6.

Examples

Input

3
1 2 3


Output

1.000000000000000


Input

4
1 2 3 4


Output

2.000000000000000


Input

10
1 10 2 9 3 8 4 7 5 6


Output

4.500000000000000

Note

For the first case, the optimal value of x is 2 so the sequence becomes  - 1, 0, 1 and the max poorness occurs at the segment "-1" or segment "1". The poorness value (answer) equals to 1 in this case. 

For the second sample the optimal value of x is 2.5 so the sequence becomes  - 1.5, - 0.5, 0.5, 1.5 and the max poorness occurs on segment "-1.5 -0.5" or "0.5 1.5". The poorness value (answer) equals to 2 in this case.

Solution (in JAVA):

Solution:
/**
 * @author derrick20
 */
import java.io.*;
import java.util.*;

public class WeaknessConvexHull {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        int N = sc.nextInt();
        arr = sc.nextDoubles(N);
        ArrayList<Pair> lines = new ArrayList<>();
        /*
        Lines are stored as pairs with form (slope, intercept)
        poor_i(x) = b_i - x * i, where x is the indep var
         */
        double sum = 0;
        lines.add(new Pair(0, 0));
        for (int i = 1; i <= N; i++) {
            sum += arr[i - 1];
            Pair line = new Pair(-i, sum);
            lines.add(line);
        }
        /*
        Convex hull sweep through all the lines:

        We want to process the lines in reverse order for the upper hull
        (since steeper things will be at the start of the hull)
        On the other hand, flatter things will appear first in the lower ull
         */
        LinkedList<Pair> upperHull = new LinkedList<>();
        LinkedList<Pair> lowerHull = new LinkedList<>();

        convexHull(lowerHull, lines);
        Collections.reverse(lines);
        convexHull(upperHull, lines);
//        System.out.println(lowerHull);
//        System.out.println(upperHull);
        double ans = 1e18;
        while (upperHull.size() >= 2 && lowerHull.size() >= 2) {
            Pair intLower = intersection(lowerHull.getFirst(), lowerHull.get(1));
            Pair intUpper = intersection(upperHull.getFirst(), upperHull.get(1));
            if (intLower.a < intUpper.a) {
                double hi = upperHull.getFirst().evalAt(intLower.a);
                double lo = intLower.b;
                double bestSeg = Math.max(hi - lo, Math.max(Math.abs(hi), Math.abs(lo)));
                ans = Math.min(ans, bestSeg);
                lowerHull.pollFirst();
            }
            else {
                double hi = intUpper.b;
                double lo = lowerHull.getFirst().evalAt(intUpper.a);
                double bestSeg = Math.max(hi - lo, Math.max(Math.abs(hi), Math.abs(lo)));
                ans = Math.min(ans, bestSeg);
                upperHull.pollFirst();
            }
        }
        while (lowerHull.size() >= 2) {
            Pair intLower = intersection(lowerHull.getFirst(), lowerHull.get(1));
            double hi = upperHull.getFirst().evalAt(intLower.a);
            double lo = intLower.b;
            double bestSeg = Math.max(hi - lo, Math.max(Math.abs(hi), Math.abs(lo)));
            ans = Math.min(ans, bestSeg);
            lowerHull.pollFirst();
        }
        while (upperHull.size() >= 2) {
            Pair intUpper = intersection(upperHull.getFirst(), upperHull.get(1));
            double hi = intUpper.b;
            double lo = lowerHull.getFirst().evalAt(intUpper.a);
            double bestSeg = Math.max(hi - lo, Math.max(Math.abs(hi), Math.abs(lo)));
            ans = Math.min(ans, bestSeg);
            upperHull.pollFirst();
        }
        if (!(upperHull.size() == 1) && (lowerHull.size() == 1)) {
            System.out.println("Didn't finish!");
        }
        out.println(ans);
        out.close();
    }

    static double[] arr;
    static double oo = 1e9;

    static void convexHull(LinkedList<Pair> hull, ArrayList<Pair> lines) {
        for (Pair next : lines) {
            while (hull.size() >= 2) {
                Pair curr = hull.getLast();
                Pair prev = hull.get(hull.size() - 2);
                if (intersection(next, prev).a <= intersection(curr, prev).a) {
                    hull.pollLast();
                }
                else {
                    break;
                }
            }
            hull.add(next);
        }
    }

    static Pair intersection(Pair p1, Pair p2) {
        double x = (p2.b - p1.b) / (p1.a - p2.a);
        double y = p1.a * x + p1.b;
        return new Pair(x, y);
    }

    static class Pair {
        double a, b;
        public Pair(double aa, double bb) {
            a = aa; b = bb;
        }
        public String toString() {
            return "(" + String.format("%.2f", a) + ", " + String.format("%.2f", b) + ")";
        }
        public double evalAt(double x) {
            return a * x + b;
        }
    }

    static class FastScanner {
        private int BS = 1<<16;
        private char NC = (char)0;
        private byte[] buf = new byte[BS];
        private int bId = 0, size = 0;
        private char c = NC;
        private double cnt = 1;
        private BufferedInputStream in;

        public FastScanner() {
            in = new BufferedInputStream(System.in, BS);
        }

        public FastScanner(String s) {
            try {
                in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
            }
            catch (Exception e) {
                in = new BufferedInputStream(System.in, BS);
            }
        }

        private char getChar(){
            while(bId==size) {
                try {
                    size = in.read(buf);
                }catch(Exception e) {
                    return NC;
                }
                if(size==-1)return NC;
                bId=0;
            }
            return (char)buf[bId++];
        }

        public int nextInt() {
            return (int)nextLong();
        }

        public int[] nextInts(int N) {
            int[] res = new int[N];
            for (int i = 0; i < N; i++) {
                res[i] = (int) nextLong();
            }
            return res;
        }

        public long[] nextLongs(int N) {
            long[] res = new long[N];
            for (int i = 0; i < N; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long nextLong() {
            cnt=1;
            boolean neg = false;
            if(c==NC)c=getChar();
            for(;(c<'0' || c>'9'); c = getChar()) {
                if(c=='-')neg=true;
            }
            long res = 0;
            for(; c>='0' && c <='9'; c=getChar()) {
                res = (res<<3)+(res<<1)+c-'0';
                cnt*=10;
            }
            return neg?-res:res;
        }

        public double nextDouble() {
            double cur = nextLong();
            return c!='.' ? cur:cur+nextLong()/cnt;
        }

        public double[] nextDoubles(int N) {
            double[] res = new double[N];
            for (int i = 0; i < N; i++) {
                res[i] = nextDouble();
            }
            return res;
        }

        public String next() {
            StringBuilder res = new StringBuilder();
            while(c<=32)c=getChar();
            while(c>32) {
                res.append(c);
                c=getChar();
            }
            return res.toString();
        }

        public String nextLine() {
            StringBuilder res = new StringBuilder();
            while(c<=32)c=getChar();
            while(c!='\n') {
                res.append(c);
                c=getChar();
            }
            return res.toString();
        }

        public boolean hasNext() {
            if(c>32)return true;
            while(true) {
                c=getChar();
                if(c==NC)return false;
                else if(c>32)return true;
            }
        }
    }
}