#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
template <typename T>
istream &operator>>(istream &in, vector<T> &vec) {
  for (int i = 0; i < vec.size(); ++i) in >> vec[i];
  return in;
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); ++i) out << vec[i] << " ";
  return out;
}
const int INT = 1e6 + 1;
long long eds = 0;
int main() {
  long long a = in(), b = in(), c, n = 0, jac = 1;
  vector<int> x(a);
  vector<int> y(a);
  vector<bool> f(a);
  priority_queue<pair<long long, int>> qu;
  for (int i = 0; i < a; ++i) {
    x[i] = in();
  }
  for (int i = 0; i < a; ++i) {
    y[i] = in();
  }
  for (int i = 0; i < a; ++i) {
    if (x[i] % 100) {
      qu.push(make_pair(-(100 - x[i] % 100) * y[i], i));
      b -= x[i] % 100;
      if (b < 0) {
        n += -(qu.top().first);
        f[qu.top().second] = true;
        qu.pop();
        b += 100;
      }
    }
  }
  cout << n << endl;
  for (int i = 0; i < a; ++i) {
    cout << f[i] + x[i] / 100 << " " << (f[i] ? 0 : x[i] % 100) << endl;
  }
  return 0;
}
