#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[100050];
int w[100050];
set<pair<long long, int> > s;
int add[100050];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> w[i];
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] % 100 == 0) continue;
    s.insert(make_pair(-(w[i] * (100 - a[i] % 100)), i));
    m -= a[i] % 100;
    if (m < 0) {
      set<pair<long long, int> >::iterator it;
      it = s.end();
      it--;
      m += 100;
      add[(*it).second] = 1;
      ans += -1 * (*it).first;
      s.erase(it);
    }
  }
  cout << ans << endl;
  for (int i = 0; i < n; i++) {
    if (add[i] == 1) {
      cout << a[i] / 100 + 1 << " " << 0 << endl;
    } else {
      cout << a[i] / 100 << " " << a[i] % 100 << endl;
    }
  }
  return 0;
}
