#include <bits/stdc++.h>
using namespace std;
ifstream fin("f.in");
const int N = 100005;
int a[N], b[N], c[N], d[N], w[N];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0, x; i < n; ++i) cin >> x, a[i] = x / 100, b[i] = x % 100;
  for (int i = 0; i < n; ++i) cin >> w[i];
  priority_queue<pair<long long, int> > pq;
  long long dis = 0;
  for (int i = 0; i < n; ++i) {
    if (b[i]) pq.push(make_pair(-w[i] * (100 - b[i]), i));
    if (m < b[i]) {
      m = m + 100 - b[i];
      dis -= pq.top().first;
      a[pq.top().second]++;
      b[pq.top().second] = 0;
      pq.pop();
    } else {
      m -= b[i];
    }
  }
  cout << dis << endl;
  for (int i = 0; i < n; ++i) {
    cout << a[i] << " " << b[i] << endl;
  }
  return 0;
}
