#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, m, c[N], w[N];
bool cg[N];
long long ans, nw;
struct P {
  int id;
  long long v;
  bool operator<(const P& ky) const { return v > ky.v; }
} tp;
priority_queue<P> que;
int main() {
  int i, j;
  scanf("%d%I64d", &n, &nw);
  for (i = 1; i <= n; ++i) scanf("%d", &c[i]);
  for (i = 1; i <= n; ++i) scanf("%d", &w[i]);
  for (i = 1; i <= n; ++i)
    if ((j = c[i] % 100)) {
      que.push({i, (long long)w[i] * (100 - j)});
      nw -= j;
      if (nw < 0) {
        tp = que.top();
        que.pop();
        cg[tp.id] = true;
        ans += tp.v;
        nw += 100;
      }
    }
  printf("%I64d\n", ans);
  for (i = 1; i <= n; ++i) {
    if (cg[i])
      printf("%d %d\n", c[i] / 100 + 1, 0);
    else
      printf("%d %d\n", c[i] / 100, c[i] % 100);
  }
  return 0;
}
