#include <bits/stdc++.h>
using namespace std;
const int mxn = 100010;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 - '0' + ch;
    ch = getchar();
  }
  return x * f;
}
struct cmp {
  int w, id;
  friend bool operator<(const cmp a, const cmp b) { return a.w > b.w; }
};
priority_queue<cmp> q;
bool note[mxn];
int n, m;
int c[mxn], w[mxn];
long long ans = 0;
void solve() {
  int i, j;
  for (i = 1; i <= n; i++) {
    int cost = c[i] % 100;
    if (!cost) continue;
    int res = 100 - cost;
    q.push((cmp){res * w[i], i});
    m -= cost;
    while (m < 0) {
      cmp tmp = q.top();
      q.pop();
      ans += tmp.w;
      note[tmp.id] ^= 1;
      m += 100;
    }
  }
  return;
}
int main() {
  int i, j;
  n = read();
  m = read();
  for (i = 1; i <= n; i++) c[i] = read();
  for (j = 1; j <= n; j++) w[j] = read();
  solve();
  printf("%I64d\n", ans);
  for (i = 1; i <= n; i++) {
    if (note[i])
      printf("%d %d\n", (c[i] + 99) / 100, 0);
    else
      printf("%d %d\n", c[i] / 100, c[i] % 100);
  }
  return 0;
}
