#include <bits/stdc++.h>
using namespace std;
using namespace std;
int n, m, i, j, x, t, y, b[100005], c[100005], d[100005], e[100005];
long long s;
priority_queue<pair<long long, long long>, vector<pair<long long, long long> >,
               greater<pair<long long, long long> > >
    a;
int main() {
  cin >> n >> t;
  for (i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (i = 1; i <= n; i++) scanf("%d", &c[i]);
  for (i = 1; i <= n; i++) {
    d[i] = b[i] / 100;
    e[i] = b[i] % 100;
    b[i] %= 100;
    if (b[i] != 0) a.push(make_pair((100 - b[i]) * c[i], i));
    if (t < b[i]) {
      t += 100;
      s += a.top().first;
      d[a.top().second]++;
      e[a.top().second] = 0;
      a.pop();
    }
    t -= b[i];
  }
  cout << s << endl;
  for (i = 1; i <= n; i++) printf("%d %d\n", d[i], e[i]);
  return 0;
}
