#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<long long> c(n), w(n);
  for (int i = 0; i < n; i++) cin >> c[i];
  for (int i = 0; i < n; i++) cin >> w[i];
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      q;
  vector<int> res(n);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    res[i] = 1;
    if (c[i] % 100 == 0) continue;
    q.emplace((100 - c[i] % 100) * w[i], i);
    m -= c[i] % 100;
    if (m < 0) {
      m += 100;
      ans += q.top().first;
      res[q.top().second] = 0;
      q.pop();
    }
  }
  cout << ans << "\n";
  for (int i = 0; i < n; i++) {
    if (res[i]) {
      cout << c[i] / 100 << " " << c[i] % 100 << "\n";
    } else
      cout << c[i] / 100 + 1 << " " << 0 << "\n";
  }
}
