codeparrot/codecomplex huggingface dataset:
// Problem: 105_B. Dark Assembly
// Time complexity: np
//package round81;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class B {
	Scanner in;
	PrintWriter out;
	String INPUT = "";
	
	void solve()
	{
		int n = ni();
		int k = ni();
		int a = ni();
		int[] lv = new int[n];
		int[] lo = new int[n];
		for(int i = 0;i < n;i++){
			lv[i] = ni();
			lo[i] = ni();
		}
		
		out.printf("%.9f", rec(lv, lo, n, 0, k, a));
	}
	
	double rec(int[] lv, int[] lo, int n, int pos, int k, int a)
	{
		if(pos == n){
			int h = n/2+1;
			double gp = 0;
			for(int i = 0;i < 1<<n;i++){
				if(Integer.bitCount(i) >= h){
					double p = 1.0;
					for(int j = 0;j < n;j++){
						if(i<<31-j<0){
							p *= (double)lo[j] / 100;
						}else{
							p *= (double)(100-lo[j]) / 100;
						}
					}
					gp += p;
				}else{
					double p = 1.0;
					int sl = 0;
					for(int j = 0;j < n;j++){
						if(i<<31-j<0){
							p *= (double)lo[j] / 100;
						}else{
							p *= (double)(100-lo[j]) / 100;
							sl += lv[j];
						}
					}
					gp += p * a/(a+sl);
				}
			}
			return gp;
		}else{
			int o = lo[pos];
			double max = 0;
			for(int i = 0;i <= k && lo[pos] <= 100;i++){
				max = Math.max(max, rec(lv, lo, n, pos+1, k-i, a));
				lo[pos]+=10;
			}
			lo[pos] = o;
			return max;
		}
	}
	
	
	
	void run() throws Exception
	{
		in = oj ? new Scanner(System.in) : new Scanner(INPUT);
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}
	
	public static void main(String[] args) throws Exception
	{
		new B().run();
	}
	
	int ni() { return Integer.parseInt(in.next()); }
	long nl() { return Long.parseLong(in.next()); }
	double nd() { return Double.parseDouble(in.next()); }
	boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.io.*;
import java.util.*;
import java.lang.reflect.Array;
import java.math.*;

public class Solution {
	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer st;
	private Random rnd;
	
	int[] levels;
	int[] loyal;
	int n, k;
	double A;
	
	int[] choices;
	int[] new_loyal;
	double[] koef;
	
	double ans = 0.0;
	int total;
	
	void rec(int step, int start) {
		if(step == k) {
			for(int i = 0; i < n; i++) {
				new_loyal[i] = loyal[i];
			}
			for(int i = 0; i < k; i++) {
				new_loyal[choices[i]] = Math.min(100, new_loyal[choices[i]] + 10);
			}
			
			int full = 0;
	
			for(int i = 0; i < n; i++) {
				if(new_loyal[i] == 100) {
					++full;
				}
			}
			
			if(full > (n / 2)) {
				ans = 1.0;
				return;
			}
			
			for(int i = 0; i < n; i++) {
				koef[i] = (double) new_loyal[i] / 100.0;
			}
			

			int bits_needed = (n / 2) + 1;
			
			double total_win = 0.0;
			double total_fights = 0.0;
			
			for(int mask = 0; mask < total; mask++) {
				int bits = 0;
				
				double win = 1.0;
				double loose = 1.0;
				double b = 0.0;
				
				for(int bit = 0; bit < n; bit++) {
					if((mask & (1 << bit)) != 0) {
						++bits;
						win *= koef[bit];
					} else {
						loose *= (1.0 - koef[bit]);
						b += levels[bit];
					}
				
				}
				
				double prob = win * loose;
				
				if(bits >= bits_needed) {
					total_win += prob;
				} else {
					total_fights += prob * (A / (A + b));
				}
			}

			
			ans = Math.max(ans, total_win + total_fights);

		} else {
			for(int i = start; i < n; i++) {
				choices[step] = i;
				rec(step + 1, i);
			}
		}
	}
	
	public void solve() throws IOException {
		n = nextInt();
		k = nextInt();
		A = nextInt();
		
		levels = new int[n];
		loyal = new int[n];
		new_loyal = new int[n];
		choices = new int[k];
		koef = new double[n];
		
		for(int i = 0; i < n; i++) {
			levels[i] = nextInt();
			loyal[i] = nextInt();
		}
		
		total = 1 << n;
		
		rec(0, 0);
		
		out.println(ans);
	}
		
	public static void main(String[] args) {
		new Solution().run();
	}
	
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			st = null;
			rnd = new Random();
			
			solve();
			
			out.close();
		} catch(IOException e) {
			e.printStackTrace();
		}
	}
	
	private String nextToken() throws IOException, NullPointerException {
		while(st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		
		return st.nextToken();
	}
	
	private int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}
	
	private long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}
	
	private double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.StringTokenizer;

public class D {
    static int n, KA, A;
    static int[] b;
    static int[] l;
    static double ans = 0;

    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        KA = in.nextInt();
        A = in.nextInt();
        b = new int[n];
        l = new int[n];

        for (int i = 0; i < l.length; i++) {
            b[i] = in.nextInt();
            l[i] = in.nextInt();
        }
        dp = new double[n + 2][n + 2][n * 9999 + 2];
        go(0, KA);
        System.out.printf("%.6f\n", ans);
    }

    public static void go(int at, int k) {
        if (at == n) {
            ans = Math.max(ans, solve(0, 0, 0));
            return;
        }
        for (int i = 0; i <= k; i++) {
            if (l[at] + i * 10 <= 100) {
                l[at] += i * 10;
                go(at + 1, k - i);
                l[at] -= i * 10;
            }
        }
    }

    static double dp[][][];

    public static double solve(int at, int ok, int B) {
        if (at == n) {
            if (ok > n / 2) {
                return 1;
            } else {
                return (A * 1.0) / (A * 1.0 + B);
            }
        }
        double ret = ((l[at]) / 100.0) * solve(at + 1, ok + 1, B)
                + (1.0 - ((l[at]) / 100.0)) * solve(at + 1, ok, B + b[at]);
        return ret;
    }

    // 3 0 31
    // 10 60
    // 12 60
    // 15 0
    static class InputReader {
        BufferedReader in;
        StringTokenizer st;

        public InputReader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
            st = new StringTokenizer(in.readLine());
        }

        public String next() throws IOException {
            while (!st.hasMoreElements())
                st = new StringTokenizer(in.readLine());
            return st.nextToken();
        }

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

        public long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }
    }
}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.io.*;
import java.util.*;

public class B {
	static double max;
	static int n, A, b[], l[];
	static int sw[];
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int k = sc.nextInt();
		A = sc.nextInt();
		b = new int[n];
		l = new int[n];
		sw = new int[n];
		for(int i=0; i<n; i++) {
			b[i] = sc.nextInt();
			l[i] = sc.nextInt();
		}
		max = 0;
		search(k, 0);
		System.out.println(max);
	}

	static void search(int k, int m) {
		if(max == 1) return;
		if(m == n) {
			if(k > 0) return;
			double pr[] = new double[n];
			for(int i=0; i<n; i++) {
				pr[i] = Math.min(100, l[i] + 10*sw[i])*1./100;
			}
			double ex = 0;
			for(int i=0; i<1<<n; i++) {
				double p = 1;
				int cnt = 0;
				int lv = 0;
				for(int j=0; j<n; j++) {
					if((i&(1<<j))>0) {
						p *= pr[j];
						cnt++;
					}
					else {
						p *= (1-pr[j]);
						lv += b[j];
					}
				}
				if(cnt > n/2) {
					ex += p;
				}
				else {
					ex += p*A/(A+lv);
				}
			}
			max = Math.max(max, ex);
			return;
		}
		for(int i=k; i>=0; i--) {
			sw[m] = i;
			search(k-i, m+1);
		}
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
			eat("");
		}

		void eat(String s) {
			st = new StringTokenizer(s);
		}

		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				throw new IOError(e);
			}
		}

		boolean hasNext() {
			while (!st.hasMoreTokens()) {
				String s = nextLine();
				if (s == null)
					return false;
				eat(s);
			}
			return true;
		}

		String next() {
			hasNext();
			return st.nextToken();
		}

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

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

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;
import static java.lang.Math.*;
public class B {

    public static void swap(int[] array, int a, int b) { // {{{
        int t = array[a];
        array[a] = array[b];
        array[b] = t;
    } // }}}

    int n, k, A;
    int[] b;
    int[] l;

    double ans;

    double cal() {
        double total = 0;
        for (int mask=0;mask<(1<<n);mask++) {
            int bit = Integer.bitCount(mask);
            double p = 1;
            for (int i=0;i<n;i++) {
                if ((mask&(1<<i))!=0)
                    p *= l[i]/10.0;
                else 
                    p *= 1.0-l[i]/10.0;
            }

            if (bit*2>n) 
                total += p;
            else {
                int B = 0;
                for (int i=0;i<n;i++) {
                    if ((mask&(1<<i))==0) {
                        B += b[i];
                    }
                }
                total += p*(A/(double)(A+B));
            }
        }
        return total;
    }

    void rec(int d, int remain) {
        ans = max(ans, cal());
        if (remain==0) return;
        for (int i=d;i<n;i++) {
            if (l[i]==10) continue;
            l[i]++;
            rec(i, remain-1);
            l[i]--;
        }
    }

    public B() throws Exception {
        n = in.nextInt();
        k = in.nextInt();
        A = in.nextInt();

        b = new int[n];
        l = new int[n];
        for (int i=0;i<n;i++) {
            b[i] = in.nextInt();
            l[i] = in.nextInt()/10;
        }

        ans = 0;
        rec(0, k);

        System.out.print(ans);
    }

    Scanner in = new Scanner(System.in);
    StringBuilder buf = new StringBuilder();
    public static void main(String[] args) throws Exception { // {{{
        new B();
    } // }}}
    public static void debug(Object... arr) { // {{{
        System.err.println(Arrays.deepToString(arr));
    } // }}}
}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import static java.lang.Math.max;
import static java.lang.Math.min;

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

public class B {

	private void solve() throws IOException {
		int senators = nextInt();
		int candies = nextInt();
		scoreA = nextInt();
		lvl = new int[senators];
		unloyal = new int[senators];
		for (int i = 0; i < senators; i++) {
			lvl[i] = nextInt();
			unloyal[i] = 10 - nextInt() / 10;
		}
		n = senators;
		give = new int[n];
		res = 0;
		go(0, candies);
		out.println(res);
	}

	static double res;
	static int[] lvl;
	static int[] unloyal;
	static int[] give;
	static int n;
	static int scoreA;

	static double probability() {
		double res = 0;
		for (int mask = 0; mask < 1 << n; mask++) {
			double p = 1;
			int scoreB = 0;
			int cntGood = Integer.bitCount(mask);
			for (int i = 0; i < n; i++) {
				int cnt = unloyal[i] - give[i];
				if ((mask & (1 << i)) == 0) {
					scoreB += lvl[i];
					p *= cnt * .1;
				} else {
					p *= (10 - cnt) * .1;
				}
			}
			if (2 * cntGood > n) {
				res += p;
			} else {
				res += p * scoreA / (scoreA + scoreB);
			}
		}
		return res;
	}

	static void go(int man, int candies) {
		if (man == n) {
			res = max(res, probability());
			return;
		}
		give[man] = 0;
		go(man + 1, candies);
		for (int i = 1; i <= min(unloyal[man], candies); i++) {
			give[man] = i;
			go(man + 1, candies - i);
		}
	}

	public static void main(String[] args) {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			new B().solve();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(239);
		}
	}

	static BufferedReader br;
	static StringTokenizer st;
	static PrintWriter out;

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

	static int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	static long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.util.*;

public class b {
	static int n,k,A;
	static int[] l,p;
	static double [][][] memo;
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		n = in.nextInt();
		k = in.nextInt();
		A = in.nextInt();
		memo = new double[n+1][n+1][1<<n];
		l = new int[n];
		p = new int[n];
		for(int i=0; i<n; i++) {
			l[i] = in.nextInt();
			p[i] = in.nextInt();
		}
		System.out.printf("%.10f%n",go(0,k));
	}
	static double go(int pos, int left) {
		if(pos==n) {
			for(int i=0; i<=n; i++)
				for(int j=0; j<=n; j++)
					Arrays.fill(memo[i][j],-1);
			return go2(0,n/2+1,0);
		}
		double best = go(pos+1,left);
		if(left == 0) return best;
		if(p[pos] < 100) {
			p[pos] += 10;
			best = Math.max(best, go(pos,left-1));
			p[pos] -= 10;
		}
		return best;
	}
	static double go2(int pos, int needed, int mask) {
		if(needed == 0) return 1.0;
		if(pos == n) {
			int tot = 0;
			for(int i=0; i<n; i++)
				if((mask&(1<<i))!=0)
					tot += l[n-i-1];
			return (A)/(A+tot+0.0);
		}
		if(memo[pos][needed][mask] != -1) 
			return memo[pos][needed][mask];
		double a = (p[pos]/100.)*go2(pos+1,needed-1,mask*2);
		double b = (1-(p[pos]/100.))*go2(pos+1,needed,mask*2+1);
		return memo[pos][needed][mask] = a+b;
	}
}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.awt.Point;
import java.util.Scanner;

public class p105b {
    static int[] b, l;
    static int n;
    static int A;
    static boolean[] masks;
    static double max;

    public static double work(int index, int k, int mask) {
        if (index == n) {
            if (Integer.bitCount(mask) * 2 <= n) {
                int sum = 0;
                for (int i = 0; i < n; i++) {
                    if (((1 << i) & mask) == 0) {
                        sum += b[i];
                    }
                }
                return (A * 1.0) / (A * 1.0 + sum);
            }
            return 1;
        }
        double max = 0;
        int to = Math.min(k, (100 - l[index]) / 10);

        for (int i = to; i >= 0; i--) {
            double loy = l[index] + i * 10;

            double b = ((100.0 - loy) / 100.0) * work(index + 1, k - i, mask);

            double a = (loy / 100.0)
                    * work(index + 1, k - i, (mask | (1 << index)));

            max = Math.max(max, a + b);
        }
        return max;
    }

    public static void rec(int index, int k) {
        if (k == -1)
            return;
        if (index == n) {
            double tot = 0;
            for (int i = 0; i < 1 << n; i++) {
                double temp = 1.0;
                int bb = 0;
                for (int j = 0; j < n; j++) {
                    if(l[j]>100)
                        return;
                    if (((1 << j) & i) != 0) {
                        temp *= (l[j] * 1.0 / 100.0);
                    } else {
                        bb += b[j];
                        temp *= ((100.0 - l[j]) / 100.0);
                    }
                }
                if (Integer.bitCount(i) * 2 <= n) {
                    temp *= (A * 1.0) / (A * 1.0 + bb);
                }
                tot += temp;
            }
            max = Math.max(max, tot);
            return;
        }
        l[index] += 10;
        rec(index, k - 1);
        l[index] -= 10;
        rec(index + 1, k);
    }

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

        A = in.nextInt();

        b = new int[n];
        l = new int[n];
        for (int i = 0; i < n; i++) {
            b[i] = in.nextInt();
            l[i] = in.nextInt();
        }
        masks = new boolean[1 << n];

        max = 0;
        rec(0, k);
        System.out.println(max);
    }
}

/*
 * 5 3 100 23 70 80 30 153 70 11 80 14 90
 */
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.io.*;

import java.awt.geom.Point2D;
import java.text.*;
import java.math.*;
import java.util.*;

public class Main implements Runnable {

	final String filename = "";

	public int nextPerm(int[] a, int k) {
		if (a[0] == k)
			return -1;
		int last = 0;
		for (int i = a.length - 1; i >= 0; i--)
			if (a[i] != 0) {
				last = i;
				break;
			}
		int mem=a[last];
		a[last-1]++;
		a[last]=0;
		a[a.length-1]=mem-1;
		return 0;
	}
	
	public double poss(int A,int[][] sen,int[] rasp){
		int n=sen.length;
		double[] possluck=new double[n];
		for(int i=0;i<n;i++)
			possluck[i]=Math.min(100, sen[i][1]+rasp[i]*10)/100.0;
		double poss=0;
		for(int i=0;i<(1<<n);i++){
			int kol=0;
			for(int j=0;j<n;j++)
				if((i%(1<<(j+1)))/(1<<(j))==1)
					kol++;
			double thisposs=1;
			for(int j=0;j<n;j++)
				if((i%(1<<(j+1)))/(1<<(j))==1)
					thisposs*=possluck[j];
				else
					thisposs*=(1-possluck[j]);
			if(kol>n/2)
				poss+=thisposs;
			else{
				double lvl=0;
				for(int j=0;j<n;j++)
					if((i%(1<<(j+1)))/(1<<(j))==0)
						lvl+=sen[j][0];
				poss+=thisposs*(A/(A+lvl));
			}
		}
		return poss;
	}

	public void solve() throws Exception {
		int n = iread(), k = iread(), A = iread();
		int[][] sen = new int[n][2];
		for (int i = 0; i < n; i++) {
			sen[i][0] = iread();
			sen[i][1] = iread();
		}
		double maxposs=0;
		int[] rasp=new int[n];
		rasp[n-1]=k;
		maxposs=Math.max(maxposs, poss(A,sen,rasp));
		while(nextPerm(rasp,k)==0)
			maxposs=Math.max(maxposs, poss(A,sen,rasp));
		out.write(maxposs+"\n");
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new BufferedWriter(new OutputStreamWriter(System.out));
			// in = new BufferedReader(new FileReader(filename+".in"));
			// out = new BufferedWriter(new FileWriter(filename+".out"));
			solve();
			out.flush();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public int iread() throws Exception {
		return Integer.parseInt(readword());
	}

	public double dread() throws Exception {
		return Double.parseDouble(readword());
	}

	public long lread() throws Exception {
		return Long.parseLong(readword());
	}

	BufferedReader in;

	BufferedWriter out;

	public String readword() throws IOException {
		StringBuilder b = new StringBuilder();
		int c;
		c = in.read();
		while (c >= 0 && c <= ' ')
			c = in.read();
		if (c < 0)
			return "";
		while (c > ' ') {
			b.append((char) c);
			c = in.read();
		}
		return b.toString();
	}

	public static void main(String[] args) {
		try {
			Locale.setDefault(Locale.US);
		} catch (Exception e) {

		}
		// new Thread(new Main()).start();
		new Thread(null, new Main(), "1", 1 << 25).start();
	}
}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.awt.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
public class B {
	static int ourLevel;
	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 k = Integer.parseInt(st.nextToken());
		ourLevel = Integer.parseInt(st.nextToken());
		State[] list = new State[n];
		for(int i = 0; i < n; i++)	{
			st = new StringTokenizer(br.readLine());
			list[i] = new State(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken())/10);
		}
		System.out.println(solve(list, 0, k));
	}
	public static double solve(State[] s, int index, int left)		{
		if(index == s.length)
			return prob(s);
		double ret = 0;
		for(int c = 0; c <= left && s[index].prob + c <= 10; c++)	{
			s[index].prob += c;
			ret = Math.max(ret, solve(s, index+1, left-c));
			s[index].prob -= c;
		}
		return ret;
	}
	public static double prob(State[] s)	{
		double win = 1;
		for(int i = 0; i < (1<<s.length); i++)	{
			int numLose = s.length - Integer.bitCount(i);
			if(2*numLose >= s.length)	{
				int level = 0;
				double p = 1;
				for(int j = 0; j < s.length; j++)	{
					if((i&(1<<j)) == 0)	{
						p *= (10-s[j].prob)/10.;
						level += s[j].level;
					}
					else	{
						p *= s[j].prob/10.;
					}
				}
				double lose = level * 1.0 / (ourLevel + level);
				win -= p * lose;
			}
		}
		return win;
	}
	static class State	{
		public int level,prob;
		public State(int a, int b)	{
			level = a;
			prob = b;
		}
	}
}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;



public class Main {
    static double max = 0.0;
    public static void main(String[] args) {
        Scanner r = new Scanner(System.in);
        
        int n = r.nextInt();
        int k = r.nextInt();
        int A = r.nextInt();
        
        Person[] p = new Person[n];
        
        for(int i = 0; i < n; i++){         
            int l = r.nextInt();
            int prob = r.nextInt();
            
            p[i] = new Person(l, prob);
        }
        
        int[] add = new int[n];
        
        double res = dfs(0, k, p, add, n, A);
        
        System.out.println(res);
        
    }
    private static double dfs(int ptr, int k, Person[] p, int[] add, int n, int A) {
        if(k < 0)return 0;
        
        double res1 = 0;
        for(int m = 0; m < 1<<n; m++){
            double win = 1;
            int cnt = 0;
            for(int i = 0; i < n; i++){
                if((m & (1 << i)) == 0){
                    win *= (100-(p[i].p+add[i]))*1.0/100;
                }else{
                    win *= (add[i]+p[i].p)*1.0/100;                 
                    cnt++;
                }
            }

            if(cnt > n/2){
                res1 += win; 
            }else{
                int B = 0;
                for(int i = 0; i < n; i++){
                    if((m & (1 << i)) == 0){
                        B += p[i].l;
                    }
                }
                
                win *= A*1.0/(A+B);
                                
                res1 += win; 
            }
        }
        
        double res2 = 0, res3 = 0;
        
        if(add[ptr]+p[ptr].p < 100){
            add[ptr] += 10;
            res2 = dfs(ptr, k-1, p, add, n, A);
            add[ptr] -= 10;
        }
        if(ptr+1 < n){
            res3 = dfs(ptr+1, k, p, add, n, A);
        }
        
        return Math.max(res1, Math.max(res2, res3));
    }
}
class Person{
    int l, p;
    public Person(int li, int pi){
        l = li;
        p = pi;
    }
    public String toString(){
        return String.format("[%d, %d]", l, p);
    }
}