#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 10;
long long c[maxn], w[maxn], ansh[maxn], ansy[maxn];
priority_queue<pair<long long, long long> > q;
signed main() {
  long long n, m, ans = 0;
  cin >> n >> m;
  for (long long i = 1; i <= n; ++i) {
    cin >> c[i];
    ansh[i] = c[i] / 100;
    c[i] %= 100;
  }
  for (long long i = 1; i <= n; ++i) {
    cin >> w[i];
  }
  for (long long i = 1; i <= n; ++i) {
    ansy[i] += c[i];
    if (c[i]) q.push(make_pair(-1 * w[i] * (100 - c[i]), i));
    if (c[i] > m) {
      long long y = q.top().first, d = q.top().second;
      q.pop();
      ans += -1 * y;
      ansy[d] -= c[d];
      ansh[d] += 1;
      m += 100;
    }
    m -= c[i];
  }
  cout << ans << endl;
  for (long long i = 1; i <= n; ++i) {
    cout << ansh[i] << " " << ansy[i] << endl;
  }
  return 0;
}
