#include <bits/stdc++.h>
const int MAX_N = 100000;
struct Day {
  int index;
  int c;
  int w;
  bool angry;
  bool operator<(const Day &other) const {
    return this->upset() > other.upset();
  }
  int upset() const { return (100 - this->c % 100) * this->w; }
};
std::priority_queue<Day> heap;
Day days[MAX_N];
int main(void) {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) days[i].index = i;
  for (int i = 0; i < n; i++) scanf("%d", &days[i].c);
  for (int i = 0; i < n; i++) scanf("%d", &days[i].w);
  long long answer = 0;
  int sumC = 0;
  for (int i = 0; i < n; i++) {
    if (days[i].c % 100 > 0) {
      heap.push(days[i]);
      sumC += days[i].c % 100;
      if (sumC > m) {
        answer += heap.top().upset();
        days[heap.top().index].angry = true;
        heap.pop();
        m += 100;
      }
    }
  }
  printf("%lld\n", answer);
  for (int i = 0; i < n; i++) {
    if (days[i].angry)
      printf("%d 0\n", days[i].c / 100 + 1);
    else
      printf("%d %d\n", days[i].c / 100, days[i].c % 100);
  }
  return 0;
}
