#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 3;
long long N, M, c[MAXN], w[MAXN], ans;
bool change[MAXN];
priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
               greater<pair<long long, long long>>>
    que;
int main() {
  scanf("%lld%lld", &N, &M);
  for (int i = 0; i < N; ++i) scanf("%lld", &c[i]);
  for (int i = 0; i < N; ++i) scanf("%lld", &w[i]);
  long long now = 0;
  while (now < N) {
    bool in = false;
    while (c[now] % 100 <= M && now < N) {
      in = true;
      if (c[now] % 100) que.push(make_pair((100 - c[now] % 100) * w[now], now));
      M -= c[now] % 100;
      ++now;
    }
    if (now < N) {
      if (c[now] % 100) que.push(make_pair((100 - c[now] % 100) * w[now], now));
      M -= c[now] % 100;
      ++now;
    }
    while (M < 0 && que.size()) {
      pair<long long, long long> p = que.top();
      que.pop();
      ans += p.first;
      change[p.second] = true;
      M += 100;
    }
  }
  printf("%lld\n", ans);
  for (int i = 0; i < N; ++i)
    if (change[i])
      printf("%lld %lld\n", c[i] / 100 + 1, 0ll);
    else
      printf("%lld %lld\n", c[i] / 100, c[i] % 100);
  return 0;
}
