Problem: One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheaper). If there are several items with the same minimum price, the discount is available for only one of them!

Polycarpus has k carts, and he wants to buy up all stools and pencils from the supermarket. Help him distribute the stools and the pencils among the shopping carts, so that the items' total price (including the discounts) is the least possible.

Polycarpus must use all k carts to purchase the items, no shopping cart can remain empty. Each shopping cart can contain an arbitrary number of stools and/or pencils.

Input

The first input line contains two integers n and k (1 ≤ k ≤ n ≤ 103) — the number of items in the supermarket and the number of carts, correspondingly. Next n lines describe the items as "ci ti" (without the quotes), where ci (1 ≤ ci ≤ 109) is an integer denoting the price of the i-th item, ti (1 ≤ ti ≤ 2) is an integer representing the type of item i (1 for a stool and 2 for a pencil). The numbers in the lines are separated by single spaces.

Output

In the first line print a single real number with exactly one  decimal place — the minimum total price of the items, including the discounts.

In the following k lines print the descriptions of the items in the carts. In the i-th line print the description of the i-th cart as "t b1 b2 ... bt" (without the quotes), where t is the number of items in the i-th cart, and the sequence b1, b2, ..., bt (1 ≤ bj ≤ n) gives the indices of items to put in this cart in the optimal distribution. All indices of items in all carts should be pairwise different, each item must belong to exactly one cart. You can print the items in carts and the carts themselves in any order. The items are numbered from 1 to n in the order in which they are specified in the input.

If there are multiple optimal distributions, you are allowed to print any of them.

Examples

Input

3 2
2 1
3 2
3 1


Output

5.5
2 1 2
1 3


Input

4 3
4 1
1 2
2 2
3 2


Output

8.0
1 1
2 4 2
1 3

Note

In the first sample case the first cart should contain the 1st and 2nd items, and the second cart should contain the 3rd item. This way each cart has a stool and each cart has a 50% discount for the cheapest item. The total price of all items will be: 2·0.5 + (3 + 3·0.5) = 1 + 4.5 = 5.5.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1e9 + 7;
long long int INF = 1e18;
long long int power(long long int n, long long int p) {
  long long int ans = 1;
  while (p > 0) {
    p--;
    n *= n;
  }
}
long long int bitc(long long int n, long long int x) { return ((n >> x) & 1); }
long long int __gcd(long long int a, long long int b) {
  return b == 0 ? a : __gcd(b, a % b);
}
long long int sub(long long int a, long long int b, long long int p = MOD) {
  return ((a % p) - (b % p) + p) % p;
}
long long int mult(long long int a, long long int b, long long int p = MOD) {
  return ((a % p) * (b % p)) % p;
}
long long int add(long long int a, long long int b, long long int p = MOD) {
  return (a % p + b % p) % p;
}
long long int fpow(long long int n, long long int k, long long int p = MOD) {
  long long int r = 1;
  while (k > 0) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
    k = k >> 1;
  }
  return r;
}
long long int inv(long long int a, long long int p = MOD) {
  return fpow(a, p - 2, p);
}
long long int fdiv(long long int a, long long int b, long long int p = MOD) {
  long long int yinv = inv(b);
  long long int ans = (a * yinv) % p;
  return ans;
}
template <typename T>
istream &operator>>(istream &in, vector<T> &a) {
  for (auto &item : a) {
    in >> item;
  }
  return in;
}
template <typename T, typename U>
ostream &operator<<(ostream &out, pair<T, U> &a) {
  cout << a.first << " " << a.second;
  return out;
}
template <typename T, typename U>
istream &operator>>(istream &out, pair<T, U> &a) {
  cin >> a.first >> a.second;
  return out;
}
template <typename T, typename U>
ostream &operator<<(ostream &out, map<T, U> &a) {
  for (auto &item : a) {
    out << item << "\n";
  }
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, vector<T> &a) {
  for (auto &item : a) {
    out << item << " ";
  }
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, vector<vector<T>> &a) {
  for (auto &item : a) {
    out << item << "\n";
  }
  return out;
}
std::vector<bool> is_prime;
std::vector<long long int> primes;
void sieve(long long int n) {
  is_prime.resize(n + 2, true);
  primes.clear();
  long long int p;
  for (p = 2; p * p <= n; p++) {
    if (is_prime[p]) {
      long long int i;
      for (i = p * p; i <= n; i += p) {
        is_prime[i] = false;
      }
    }
  }
  is_prime[0] = is_prime[1] = false;
  long long int i;
  for (i = 2; i <= n; i++) {
    if (is_prime[i]) {
      primes.emplace_back(i);
    }
  }
}
map<long long int, long long int> prime_factors(long long int n) {
  map<long long int, long long int> s;
  long long int i;
  long long int tc = 0;
  while (n % 2 == 0) {
    tc++;
    n /= 2;
  }
  if (tc > 0) {
    s[2] = tc;
  }
  for (i = 3; i <= sqrt(n); i += 2) {
    tc = 0;
    while (n % i == 0) {
      tc++;
      n /= i;
    }
    if (tc > 0) {
      s[i] = tc;
    }
  }
  if (n > 2) {
    s[n] += 1;
  }
  return s;
}
std::vector<long long int> fact_vec;
void fact_fun(long long int n) {
  fact_vec.resize(n + 10);
  long long int i;
  fact_vec[0] = 1;
  for (i = 1; i <= n + 2; i++) {
    fact_vec[i] = (fact_vec[i - 1] * i) % MOD;
  }
}
int main() {
  long long int i, j;
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int t;
  t = 1;
  while (t--) {
    long long int n, k;
    cin >> n >> k;
    std::vector<pair<long long int, long long int>> v(n);
    for (auto &p : v) {
      cin >> p.first >> p.second;
    }
    vector<pair<long long int, long long int>> spl;
    std::vector<pair<long long int, long long int>> nspl;
    for (i = 0; i < n; i++) {
      if (v[i].second == 1) {
        spl.emplace_back(make_pair(v[i].first, i));
      } else {
        nspl.emplace_back(make_pair(v[i].first, i));
      }
    }
    std::vector<bool> hasspl(k, false);
    sort((spl).begin(), (spl).end(),
         greater<pair<long long int, long long int>>());
    std::vector<std::vector<long long int>> ans(k);
    for (i = 0; i < k - 1; i++) {
      if (spl.empty()) {
        break;
      }
      hasspl[i] = true;
      ans[i].emplace_back(spl.begin()->second);
      spl.erase(spl.begin());
    }
    for (; i < k; i++) {
      if (nspl.empty()) {
        break;
      }
      ans[i].emplace_back(nspl.begin()->second);
      nspl.erase(nspl.begin());
    }
    while (!spl.empty()) {
      ans[k - 1].emplace_back(spl.begin()->second);
      spl.erase(spl.begin());
      hasspl[k - 1] = true;
    }
    while (!nspl.empty()) {
      ans[k - 1].emplace_back(nspl.begin()->second);
      nspl.erase(nspl.begin());
    }
    long double sum = 0;
    for (i = 0; i < k; i++) {
      long double tp = 0;
      for (auto p : ans[i]) {
        tp += v[p].first;
      }
      if (hasspl[i]) {
        long long int mn = INF;
        for (auto p : ans[i]) {
          mn = min(mn, v[p].first);
        }
        tp -= mn;
        tp = (long double)tp + (long double)mn / 2;
      }
      sum = (long double)sum + tp;
    }
    cout << fixed << setprecision(1) << sum << "\n";
    for (i = 0; i < k; i++) {
      cout << ans[i].size() << " ";
      for (auto p : ans[i]) {
        cout << p + 1 << " ";
      }
      cout << "\n";
    }
  }
}