#include <bits/stdc++.h>
using namespace std;
struct node {
  long long num, lab;
  bool operator<(const node& a) const { return num > a.num; }
} e[100005];
long long a[100005], w[100005], ans1[100005], ans2[100005];
priority_queue<node, vector<node>, less<node> > sp;
int main() {
  long long n, m, i, j, ans = 0;
  scanf("%lld%lld", &n, &m);
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (i = 1; i <= n; i++) scanf("%lld", &w[i]);
  for (i = 1; i <= n; i++) {
    if (m < a[i] % 100) {
      if (sp.empty()) {
        ans += (100 - a[i] % 100) * w[i];
        m += 100 - a[i] % 100;
        ans1[i] = a[i] / 100 + 1;
        ans2[i] = 0;
      } else {
        sp.push((node){(100 - a[i] % 100) * w[i], i});
        ans1[i] = a[i] / 100;
        ans2[i] = a[i] % 100;
        ans += sp.top().num;
        ans1[sp.top().lab]++;
        ans2[sp.top().lab] = 0;
        sp.pop();
        m += 100 - a[i] % 100;
      }
    } else {
      if (a[i] % 100) sp.push((node){(100 - a[i] % 100) * w[i], i});
      ans1[i] = a[i] / 100;
      ans2[i] = a[i] % 100;
      m -= a[i] % 100;
    }
  }
  printf("%lld\n", ans);
  for (i = 1; i <= n; i++) printf("%lld %lld\n", ans1[i], ans2[i]);
  return 0;
}
