#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int N = 233333, M = 111;
long long w[N];
int f[N], c[N];
struct node {
  int i;
  bool friend operator<(node a, node b) { return w[a.i] > w[b.i]; }
};
priority_queue<node> q;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &c[i]);
  }
  for (int i = 0; i < n; i++) {
    int k;
    scanf("%d", &k);
    w[i] = k * (100 - c[i] % 100);
  }
  long long ans = 0;
  memset(f, 0, sizeof(f));
  for (int i = 0; i < n; i++)
    if (c[i] % 100) {
      m -= c[i] % 100;
      q.push((node){i});
      if (m < 0) {
        int j = q.top().i;
        q.pop();
        ans += w[j];
        m += 100;
        f[j] = 1;
      }
    }
  cout << ans << endl;
  for (int i = 0; i < n; i++) {
    if (f[i])
      printf("%d 0\n", c[i] / 100 + 1);
    else
      printf("%d %d\n", c[i] / 100, c[i] % 100);
  }
  return 0;
}
