#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, M;
  cin >> N >> M;
  vector<int> C(N);
  for (int& c : C) {
    cin >> c;
  }
  vector<int> W(N);
  for (int& w : W) {
    cin >> w;
  }
  vector<char> mark(N, false);
  priority_queue<pair<int, int>> Q;
  int64_t result = 0;
  for (int i = 0; i < N; ++i) {
    int need = C[i] % 100;
    if (need == 0) {
      continue;
    }
    Q.push({-(100 - need) * W[i], i});
    M -= need;
    if (M < 0) {
      assert(M > -100);
      assert(!Q.empty());
      auto top = Q.top();
      Q.pop();
      mark[top.second] = true;
      result -= top.first;
      M += 100;
    }
  }
  cout << result << '\n';
  for (int i = 0; i < N; ++i) {
    if (!mark[i]) {
      cout << C[i] / 100 << ' ' << C[i] % 100 << '\n';
    } else {
      cout << (C[i] + 99) / 100 << ' ' << 0 << '\n';
    }
  }
  return 0;
}
