#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-8;
long long powmod(long long a, long long x, long long mod) {
  long long t = 1ll;
  while (x) {
    if (x & 1) t = t * a % mod;
    a = a * a % mod;
    x >>= 1;
  }
  return t;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int n, m;
int c[maxn], w[maxn];
bool vis[maxn];
set<pair<int, int> > st;
int main() {
  int i, j;
  long long ans = 0;
  scanf("%d%d", &n, &m);
  memset(vis, 0, sizeof(vis));
  for (i = 1; i <= n; i++) scanf("%d", &c[i]);
  for (i = 1; i <= n; i++) {
    scanf("%d", &w[i]);
  }
  for (i = 1; i <= n; i++) {
    if (c[i] % 100 == 0) continue;
    m = m - c[i] % 100;
    st.insert(make_pair((100 - c[i] % 100) * w[i], i));
    if (m < 0) {
      m += 100;
      ans += st.begin()->first;
      vis[st.begin()->second] = 1;
      st.erase(st.begin());
    }
  }
  cout << ans << endl;
  for (i = 1; i <= n; i++) {
    if (vis[i]) {
      printf("%d 0\n", c[i] / 100 + 1);
    } else
      printf("%d %d\n", c[i] / 100, c[i] % 100);
  }
  return 0;
}
