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
#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
using namespace std;
namespace IO {
const int SIZE = 1 << 20;
char buf[SIZE], *p1 = buf, *p2 = buf;
char obuf[SIZE], *O = obuf;
int getc() { return getchar(); }
int read() {
  int x = 0, f = 0;
  char ch = getc();
  while (!isdigit(ch)) f |= ch == '-', ch = getc();
  while (isdigit(ch)) x = 10 * x + ch - '0', ch = getc();
  return f ? -x : x;
}
template <typename T>
void print(T x) {
  if (x < 0) *O++ = '-', x = -x;
  if (x > 9) print(x / 10);
  *O++ = char(x % 10 + '0');
}
template <typename T>
void print(T x, char opt) {
  print(x), *O++ = opt;
}
void Flush() { fwrite(obuf, O - obuf, 1, stdout); }
}  // namespace IO
using namespace IO;
const int N = 3005;
void ckmax(int &a, int b) {
  if (a < b) a = b;
}
vector<int> a[N];
long long sum[N];
int l[N], n, k;
vector<long long> solve(int l, int r) {
  if (l == r) {
    vector<long long> res(k + 1);
    for (int i = 1; i <= min(::l[l], k); i++) {
      res[i] = res[i - 1] + a[l][i];
    }
    return res;
  }
  int mid = l + r >> 1;
  vector<long long> L = solve(l, mid), R = solve(mid + 1, r);
  vector<long long> res(k + 1);
  for (int i = mid + 1; i <= r; i++) {
    int tot = min(::l[i], k);
    for (int j = k; j >= tot; j--) L[j] = max(L[j], L[j - tot] + sum[i]);
  }
  for (int i = l; i <= mid; i++) {
    int tot = min(::l[i], k);
    for (int j = k; j >= tot; j--) R[j] = max(R[j], R[j - tot] + sum[i]);
  }
  for (int i = 0; i <= k; i++) res[i] = max(L[i], R[i]);
  return res;
}
int main() {
  n = read(), k = read();
  for (int i = 1; i <= n; i++) {
    l[i] = read(), a[i].resize(l[i] + 1);
    for (int j = 1; j <= l[i]; j++) {
      a[i][j] = read();
      if (j <= k) sum[i] += a[i][j];
    }
  }
  vector<long long> ans = solve(1, n);
  printf("%lld\n", ans[k]);
  return 0;
}
