#include <bits/stdc++.h>
using namespace std;
const int max_n = 100111;
int c[max_n], w[max_n], n;
long long sum, nedov = 0;
vector<pair<int, int> > cost;
set<pair<int, int> > sett;
pair<int, int> ans[max_n];
int main() {
  scanf("%d%d", &n, &sum);
  for (int i = 0; i < n; ++i) {
    scanf("%d", c + i);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", w + i);
    if (c[i] % 100 == 0) {
      ans[i].first = c[i] / 100;
      ans[i].second = 0;
      continue;
    }
    int ned = w[i] * (100 - (c[i] % 100));
    cost.push_back(make_pair(ned, i));
  }
  for (pair<int, int> p : cost) {
    sett.insert(p);
    sum -= c[p.second] % 100;
    ans[p.second].first = c[p.second] / 100;
    ans[p.second].second = c[p.second] % 100;
    if (sum < 0) {
      sum += 100;
      nedov += sett.begin()->first;
      ans[sett.begin()->second].first++;
      ans[sett.begin()->second].second = 0;
      sett.erase(sett.begin());
    }
  }
  printf("%I64d\n", nedov);
  for (int i = 0; i < n; ++i) {
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}
