#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
set<pair<int, int> > s;
int n, a[maxn], b[maxn];
long long ans, m;
bool bb[maxn];
inline void get_ready() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
}
inline void solve() {
  for (int i = 1; i <= n; i++) {
    int res = a[i] % 100;
    if (!res) continue;
    m -= res;
    s.insert(make_pair((100 - res) * b[i], i));
    if (m < 0) {
      pair<int, int> pp = *s.begin();
      ans += pp.first;
      bb[pp.second] = 1;
      s.erase(s.begin());
      m += 100;
    }
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++)
    printf("%d %d\n", a[i] / 100 + bb[i], bb[i] ? 0 : a[i] % 100);
}
int main() {
  get_ready();
  solve();
  return 0;
}
