#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
template <class T>
T power(T a, T b) {
  T result = 1;
  while (b > 0) {
    if (b & 1) result = result * a;
    a = a * a;
    b >>= 1;
  }
  return result;
}
template <class T>
T powerMod(T a, T b, T c) {
  T result = 1 % c;
  while (b > 0) {
    if (b & 1) result = (result * a) % c;
    a = (a * a) % c;
    b >>= 1;
  }
  return result;
}
long long notes[100100], coins[100100], C[100100], W[100100];
void eval() {
  set<pair<long long, long long> > pq;
  set<pair<long long, long long> >::iterator it;
  long long n, m, i, res, idx;
  pair<long long, long long> top;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> C[i];
    notes[i] = C[i] / 100;
    C[i] = C[i] % 100;
  }
  for (i = 0; i < n; i++) {
    cin >> W[i];
  }
  res = 0;
  for (i = 0; i < n; i++) {
    if (C[i] > 0) {
      pq.insert(make_pair((100 - C[i]) * W[i], i));
      coins[i] = C[i];
      m = m - C[i];
      if (m < 0) {
        it = pq.begin();
        top = *it;
        pq.erase(it);
        m = m + 100;
        res = res + top.first;
        idx = top.second;
        coins[idx] = 0;
        notes[idx]++;
      } else {
      }
    }
  }
  cout << res << "\n";
  for (i = 0; i < n; i++) {
    cout << notes[i] << " " << coins[i] << "\n";
  }
}
int main() {
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  eval();
  return 0;
}
