Nick has n bottles of soda left after his birthday. Each bottle is described by two values: remaining amount of soda ai and bottle volume bi (ai ≤ bi).

Nick has decided to pour all remaining soda into minimal number of bottles, moreover he has to do it as soon as possible. Nick spends x seconds to pour x units of soda from one bottle to another.

Nick asks you to help him to determine k — the minimal number of bottles to store all remaining soda and t — the minimal time to pour soda into k bottles. A bottle can't store more soda than its volume. All remaining soda should be saved.

Input

The first line contains positive integer n (1 ≤ n ≤ 100) — the number of bottles.

The second line contains n positive integers a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the amount of soda remaining in the i-th bottle.

The third line contains n positive integers b1, b2, ..., bn (1 ≤ bi ≤ 100), where bi is the volume of the i-th bottle.

It is guaranteed that ai ≤ bi for any i.

Output

The only line should contain two integers k and t, where k is the minimal number of bottles that can store all the soda and t is the minimal time to pour the soda into k bottles.

Examples

Input

4
3 3 4 3
4 7 6 5


Output

2 6


Input

2
1 1
100 100


Output

1 1


Input

5
10 30 5 6 24
10 41 7 8 24


Output

3 11

Note

In the first example Nick can pour soda from the first bottle to the second bottle. It will take 3 seconds. After it the second bottle will contain 3 + 3 = 6 units of soda. Then he can pour soda from the fourth bottle to the second bottle and to the third bottle: one unit to the second and two units to the third. It will take 1 + 2 = 3 seconds. So, all the soda will be in two bottles and he will spend 3 + 3 = 6 seconds to do it.
import java.util.*;
import java.io.*;
 
public class Main2 {
	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; } 
    }
	static long mod = (long)(1e9+7);
//	static long mod = 998244353;
//	static Scanner sc = new Scanner(System.in);
	static FastReader sc = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);
	static pair a[];
	static pair dp[][];
	public static void main (String[] args) {
		int t = 1;
//    	t = sc.nextInt();
	    z : for(int tc=1;tc<=t;tc++) {
	    	int n = sc.nextInt();
	    	a = new pair[n];
	    	int sum = 0;
	    	for(int i=0;i<n;i++) {
	    		a[i] = new pair(0,0);
	    		a[i].a = sc.nextInt();
	    		sum += a[i].a;
	    	}
	    	for(int i=0;i<n;i++) {
	    		a[i].b = sc.nextInt();
	    	}
	    	Arrays.sort(a,new Comparator<pair>() {

				@Override
				public int compare(pair o1, pair o2) {
					return o2.a - o1.a;
				}
	    		
	    	});
	    	dp = new pair[n][sum+1];
	    	pair ans = find(0,sum);
	    	out.write(ans.a+" "+ans.b);
	    }
		out.close();
	}
	private static pair find(int i, int sum) {
		if(i == a.length) {
			if(sum == 0) return new pair(0,0);
			return new pair((int)(1e6),(int)(1e6));
		}
		
		if(dp[i][sum] != null) return dp[i][sum];
		
		int tsum = sum;
		if(tsum>=a[i].a) tsum -= a[i].a;
		else tsum = 0;
		int eadd = Math.min(tsum, a[i].b-a[i].a);
		tsum -= eadd;
		pair resss1 = find(i+1,tsum);
		pair res1 = new pair(resss1.a + 1, resss1.b + eadd);
		
		pair res2 = find(i+1,sum);
		pair res3 = find(i+1,Math.max(0, sum-a[i].a));
		res3 = new pair(res3.a+1,res3.b);
		
		pair ret;
		if(res1.isGreater(res2) && res1.isGreater(res3)) ret = res1;
		else if(res2.isGreater(res1) && res2.isGreater(res3)) ret = res2;
		else ret = res3;
//		System.out.println("i "+i+" sum "+sum+" ret.a "+ret.a+" ret.b "+ret.b);
		return dp[i][sum] = ret;
	}
	private static void sort(int[] a) {List<Integer> k = new ArrayList<>();for(int val : a) k.add(val);Collections.sort(k);for(int i=0;i<a.length;i++) a[i] = k.get(i);}
	private static void ini(List<Integer>[] tre2){for(int i=0;i<tre2.length;i++){tre2[i] = new ArrayList<>();}}
	private static void init(List<int[]>[] tre2){for(int i=0;i<tre2.length;i++){tre2[i] = new ArrayList<>();}}
	private static void sort(long[] a) {List<Long> k = new ArrayList<>();for(long val : a) k.add(val);Collections.sort(k);for(int i=0;i<a.length;i++) a[i] = k.get(i);}
}
class pair{
	int a;
	int b;
	pair(int val,int came){
		this.a = val;
		this.b = came;
	}
	boolean isGreater(pair p) {
		if(this.a!=p.a) return this.a<p.a;
		return this.b<=p.b;
	}
}