#include <bits/stdc++.h>
using namespace std;
int n;
long long m;
long long c[100005];
long long w[100005];
int ans[100005];
struct node {
  int id;
  long long val;
  bool friend operator<(node x, node y) { return x.val > y.val; }
};
int main() {
  while (~scanf("%d%lld", &n, &m)) {
    for (int i = 0; i < n; i++) {
      scanf("%lld", &c[i]);
      ans[i] = 0;
    }
    for (int i = 0; i < n; i++) {
      scanf("%lld", &w[i]);
    }
    priority_queue<node> q;
    long long anss = 0;
    for (int i = 0; i < n; i++) {
      long long cost = c[i] % 100;
      long long val = w[i] * (100 - cost);
      node cur;
      cur.id = i;
      cur.val = val;
      if (cost != 0) q.push(cur);
      m -= cost;
      if (m < 0) {
        node fst = q.top();
        anss += fst.val;
        m += 100;
        q.pop();
        ans[fst.id] = 1;
      }
    }
    printf("%lld\n", anss);
    for (int i = 0; i < n; i++) {
      if (ans[i] == 0) {
        printf("%lld %lld\n", c[i] / 100, c[i] % 100);
      } else {
        printf("%lld %lld\n", c[i] / 100 + 1, 0);
      }
    }
  }
}
