#include <bits/stdc++.h>
using namespace std;
int getint() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || '9' < ch) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f * x;
}
struct node {
  long long w;
  int id;
  node() {}
  node(long long _, int __) {
    w = _;
    id = __;
  }
  bool operator<(node other) const { return w > other.w; }
};
priority_queue<node> q;
int n;
int pans[112345], cans[112345];
long long c[112345], w[112345];
int main() {
  n = getint();
  int coin = getint();
  long long ans = 0;
  for (int i = 1; i <= n; i++) c[i] = getint();
  for (int i = 1; i <= n; i++) w[i] = getint();
  for (int i = 1; i <= n; i++) {
    pans[i] = c[i] / 100;
    c[i] %= 100;
    if (c[i] == 0) continue;
    coin -= c[i];
    cans[i] = c[i];
    q.push(node(w[i] * (100 - c[i]), i));
    if (coin < 0) {
      int x = q.top().id;
      q.pop();
      pans[x]++;
      cans[x] = 0;
      ans += w[x] * (100 - c[x]);
      coin += 100;
    }
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++) printf("%d %d\n", pans[i], cans[i]);
  return 0;
}
