#include <bits/stdc++.h>
using namespace std;
template <class _Tp>
void ckmax(_Tp &a, _Tp b) {
  if (a < b) a = b;
}
template <class _Tp>
void ckmin(_Tp &a, _Tp b) {
  if (a > b) a = b;
}
template <class _Tp>
_Tp gcd(_Tp a, _Tp b) {
  return (b == 0) ? (a) : (gcd(b, a % b));
}
int read() {
  char ch = getchar();
  bool f = 1;
  int x = 0;
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') f = 0, ch = getchar();
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch & 15);
    ch = getchar();
  }
  return f ? x : -x;
}
const int inf = 1000000000;
const long long Inf = 1000000000000000000ll;
priority_queue<pair<long long, int>, vector<pair<long long, int> >,
               greater<pair<long long, int> > >
    q;
int n, m, out[100050], output[100050], c[100050], w[100050];
long long ans;
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= n; ++i) {
    out[i] = read();
    c[i] = out[i] % 100;
    out[i] = out[i] / 100;
  }
  for (int i = 1; i <= n; ++i) w[i] = read();
  for (int i = 1; i <= n; ++i) {
    output[i] = c[i];
    if (c[i]) q.push(make_pair(1ll * w[i] * (100 - c[i]), i));
    if (c[i] > m) {
      pair<long long, int> t = q.top();
      q.pop();
      out[t.second]++;
      output[t.second] = 0;
      m += 100;
      ans += t.first;
    }
    m -= c[i];
  }
  printf("%lld\n", ans);
  for (int i = 1; i <= n; ++i) printf("%d %d\n", out[i], output[i]);
  return 0;
}
