#include <bits/stdc++.h>
using namespace std;
const int max_n = 100005;
int c[max_n], w[max_n], ans[max_n][3];
struct cmp {
  bool operator()(int a, int b) {
    return w[a] * (100 - c[a] % 100) > w[b] * (100 - c[b] % 100);
  }
};
priority_queue<int, vector<int>, cmp> q;
int main() {
  long long n, m, sum = 0;
  scanf("%lld%lld", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &c[i]);
  for (int i = 0; i < n; i++) scanf("%d", &w[i]);
  for (int i = 0; i < n; i++) {
    int r = c[i] % 100;
    ans[i][0] = c[i] / 100;
    ans[i][1] = r;
    m -= r;
    if (r != 0) {
      q.push(i);
      if (m < 0) {
        int t = q.top();
        ans[t][0]++;
        ans[t][1] = 0;
        m += 100;
        sum += w[t] * (100 - c[t] % 100);
        q.pop();
      }
    }
  }
  printf("%lld\n", sum);
  for (int i = 0; i < n; i++) printf("%d %d\n", ans[i][0], ans[i][1]);
  return 0;
}
