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("O3")
#pragma GCC optimize("Ofast,no-stack-protector")
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << "\n";
  err(++it, args...);
}
function<void(void)> ____ = []() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
};
template <typename T>
vector<T> &operator<<(vector<T> &__container, T x) {
  __container.push_back(x);
  return __container;
}
template <typename T>
ostream &operator<<(ostream &out, vector<T> &__container) {
  for (T _ : __container) out << _ << ' ';
  return out;
}
void sci() {}
template <typename... Args>
void sci(int &x, Args &...args) {
  scanf("%d", &x);
  sci(args...);
}
void scl() {}
template <typename... Args>
void scl(long long int &x, Args &...args) {
  scanf("%lld", &x);
  scl(args...);
}
const int MAXN = 3e3 + 7;
int n, k;
long long int ret;
vector<long long int> vec[MAXN];
void divide(int L, int R, vector<long long int> f) {
  if (L + 1 == R) {
    for (int i = k; ~i; i--) {
      if (k - i < vec[L].size())
        ret = max(ret, f[i] + vec[L][k - i]);
      else
        break;
    }
    ret = max(ret, f[k]);
    return;
  }
  vector<long long int> g(f);
  int mid = (L + R) >> 1;
  for (int i = mid; i < R; i++) {
    int sz = vec[i].size() - 1;
    for (int j = k; j >= sz; j--) {
      g[j] = max(g[j], g[j - sz] + vec[i][sz]);
    }
  }
  divide(L, mid, g);
  for (int i = L; i < mid; i++) {
    int sz = vec[i].size() - 1;
    for (int j = k; j >= sz; j--) {
      f[j] = max(f[j], f[j - sz] + vec[i][sz]);
    }
  }
  divide(mid, R, f);
}
void solve() {
  sci(n, k);
  for (int i = 1; i <= n; i++) {
    int sz;
    sci(sz);
    vec[i].resize(sz + 1);
    vec[i][0] = 0;
    for (int j = 1; j <= sz; j++) scl(vec[i][j]), vec[i][j] += vec[i][j - 1];
  }
  divide(1, n + 1, vector<long long int>(k + 1, 0));
  cout << ret << "\n";
}
int main() {
  solve();
  return 0;
}
