#include <bits/stdc++.h>
using namespace std;
const int N = 1E5 + 10;
int n, m, a[N], c[N], w[N], v[N], f[N];
struct node {
  int id;
  bool operator<(node A) const { return v[id] > v[A.id]; }
};
priority_queue<node> Q;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i], c[i] = a[i] % 100;
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= n; i++) v[i] = (100 - c[i]) * w[i];
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (m >= c[i]) {
      f[i] = 1;
      m -= c[i];
      if (c[i]) Q.push(node{i});
      continue;
    }
    m -= c[i];
    f[i] = 1;
    Q.push(node{i});
    node top = Q.top();
    Q.pop();
    int u = top.id;
    f[u] = 0;
    m += 100;
    ans += 1ll * w[u] * (100 - c[u]);
  }
  cout << ans << "\n";
  for (int i = 1; i <= n; i++)
    if (f[i]) {
      cout << a[i] / 100 << " " << c[i] << "\n";
    } else {
      cout << (a[i] + 99) / 100 << " " << 0 << "\n";
    }
}
