#include <bits/stdc++.h>
using namespace std;
long long c[100001], w[100001], zheng[100001], ling[100001];
long long n, m, h, k, ans = 0;
priority_queue<pair<long long, long long>, vector<pair<long long, long long> >,
               greater<pair<long long, long long> > >
    q;
int main() {
  scanf("%lld %lld", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &c[i]);
    zheng[i] = c[i] / 100;
    c[i] %= 100;
  }
  for (int i = 1; i <= n; i++) scanf("%lld", &w[i]);
  for (int i = 1; i <= n; i++) {
    ling[i] += c[i];
    if (c[i]) q.push(make_pair(w[i] * (100 - c[i]), i));
    if (c[i] > m) {
      h = q.top().first;
      k = q.top().second;
      q.pop();
      ans += h;
      ling[k] -= c[k];
      zheng[k]++;
      m += 100;
    }
    m -= c[i];
  }
  printf("%lld\n", ans);
  for (int i = 1; i <= n; i++) printf("%lld %lld\n", zheng[i], ling[i]);
}
