You are given n non-decreasing arrays of non-negative numbers. 

Vasya repeats the following operation k times: 

  * Selects a non-empty array. 
  * Puts the first element of the selected array in his pocket. 
  * Removes the first element from the selected array. 



Vasya wants to maximize the sum of the elements in his pocket.

Input

The first line contains two integers n and k (1 ≤ n, k ≤ 3 000): the number of arrays and operations.

Each of the next n lines contain an array. The first integer in each line is t_i (1 ≤ t_i ≤ 10^6): the size of the i-th array. The following t_i integers a_{i, j} (0 ≤ a_{i, 1} ≤ … ≤ a_{i, t_i} ≤ 10^8) are the elements of the i-th array.

It is guaranteed that k ≤ ∑_{i=1}^n t_i ≤ 10^6.

Output

Print one integer: the maximum possible sum of all elements in Vasya's pocket after k operations.

Example

Input


3 3
2 5 10
3 1 2 3
2 1 20


Output


26
import java.io.*;
import java.util.*;
import java.math.*;
 
 
//Sub_To_Errichto
public class Main {
    //static final long MOD = 1000000007L;
    //static final long MOD2 = 1000000009L;
    static final long MOD = 998244353L;
    static final int INF = 50000000;
    //static final int NINF = -500000000;
    static final long NINF = -10000000000000000L;
    
    static int N;
    static int K;
    static long[][] nums;
    static long[][] prefs;
    static long ans;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);
        
        N = sc.ni();
        K = sc.ni();
        nums = new long[N][];
        prefs = new long[N][];
        ans = 0;
        for (int i = 0; i < N; i++) {
        	int T = sc.ni();
        	nums[i] = new long[T];
        	prefs[i] = new long[T+1];
        	for (int j = 1; j <= T; j++) {
        		nums[i][j-1] = sc.nl();
        		prefs[i][j] = nums[i][j-1]+prefs[i][j-1];
        	}
        }
        long[] dp = new long[K+1];
        Arrays.fill(dp, NINF);
        dp[0] = 0;
        divConq(0,N-1,dp);
        
        pw.println(ans);
        pw.close();
    }
    
    public static void divConq(int L, int R, long[] dp) {
    	if (L==R) {
    		for (int x = 0; x <= Math.min(K, nums[L].length); x++) {
    			ans = Math.max(ans, dp[K-x]+prefs[L][x]);
    		}
    	} else {
    		int med = (L+R)/2;
    		long[] left = Arrays.copyOfRange(dp, 0, K+1);
    		for (int i = med+1; i <= R; i++) {
    			int s = nums[i].length;
    			for (int k = K; k >= 0; k--) {
    				left[k] = Math.max(left[k],(k >= s ? left[k-s] : NINF) +prefs[i][s]);
    			}
    		}
    		long[] right = Arrays.copyOfRange(dp, 0, K+1);
    		for (int i = L; i <= med; i++) {
    			int s = nums[i].length;
    			for (int k = K; k >= 0; k--) {
    				right[k] = Math.max(right[k], (k >= s ? right[k-s] : NINF) + prefs[i][s]);
    			}
    		}
    		
    		divConq(L,med,left);
    		divConq(med+1,R,right);
    	}
    }
    
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            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 ni() {
            return Integer.parseInt(next());
        }
 
        long nl() {
            return Long.parseLong(next());
        }
 
        double nd() {
            return Double.parseDouble(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}