#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7, N = 100007;
int n, m, c[N], w[N];
set<pair<int, int> > bad;
pair<int, int> it;
vector<char> used(N, 0);
long long ans;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    scanf("%d", &c[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &w[i]);
  }
  for (int i = 0; i < n; i++) {
    if (c[i] % 100 == 0) {
      continue;
    }
    bad.insert(make_pair((100 - c[i] % 100) * w[i], i));
    m -= c[i] % 100;
    while (m < 0) {
      it = *bad.begin();
      bad.erase(it);
      used[it.second] = 1;
      m += 100;
      ans += it.first;
    }
  }
  cout << ans << endl;
  for (int i = 0; i < n; i++) {
    if (used[i]) {
      printf("%d 0\n", c[i] / 100 + 1);
    } else {
      printf("%d %d\n", c[i] / 100, c[i] % 100);
    }
  }
  return 0;
}
