#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<long long, int> > q;
int n;
long long c[100010], w[100010], ang[100010], ans, m;
int z[100010];
int main() {
  scanf("%d%lld", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &c[i]);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &w[i]);
    ang[i] = (100LL - (c[i] - 1LL) % 100LL - 1LL) * w[i];
  }
  for (int i = 1; i <= n; ++i) {
    if (c[i] % 100LL == 0) {
      z[i] = 1;
      continue;
    }
    q.push(make_pair(-ang[i], i));
    m -= c[i] % 100LL;
    if (m < 0) {
      m += 100LL;
      ans -= q.top().first;
      z[q.top().second] = 1;
      q.pop();
    }
  }
  printf("%lld\n", ans);
  for (int i = 1; i <= n; ++i) {
    if (z[i] == 1) {
      printf("%lld %lld\n", c[i] / 100LL + (long long)(c[i] % 100LL > 0), 0LL);
    } else {
      printf("%lld %lld\n", c[i] / 100LL, c[i] % 100LL);
    }
  }
  return 0;
}
