#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
int n, m, c[N], d[N], w[N];
bool val[N];
long long ans;
struct node {
  int val, id;
  bool operator<(const node A) const { return val > A.val; }
};
priority_queue<node> Q;
inline int IN() {
  char c;
  int flag = 1, k = 0;
  for (c = getchar(); c < '0' || c > '9'; c = getchar())
    if (c == '-') flag = -1;
  for (; '0' <= c && c <= '9'; c = getchar()) k = k * 10 + c - '0';
  return k * flag;
}
int main() {
  n = IN();
  m = IN();
  for (int i = 1; i <= n; ++i) c[i] = IN();
  for (int i = 1; i <= n; ++i) w[i] = IN();
  for (int i = 1; i <= n; ++i) {
    d[i] = c[i] / 100;
    int tmp = c[i] % 100;
    if (tmp == 0) continue;
    int res = w[i] * (100 - tmp);
    Q.push((node){res, i});
    m -= tmp;
    if (m < 0) {
      m += 100;
      node now = Q.top();
      Q.pop();
      ans += now.val;
      val[now.id] = 1;
    }
  }
  cout << ans << endl;
  for (int i = 1; i <= n; ++i) {
    cout << c[i] / 100 + val[i] << " ";
    if (val[i])
      cout << 0 << endl;
    else
      cout << c[i] % 100 << endl;
  }
  return 0;
}
