#include <bits/stdc++.h>
using namespace std;
struct node {
  int idx;
  long long val;
};
bool compare(node a, node b) { return a.val > b.val; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  int cost[n + 1];
  int weight[n + 1];
  for (int i = 1; i <= n; i++) cin >> cost[i];
  for (int i = 1; i <= n; i++) cin >> weight[i];
  long long ans = 0;
  priority_queue<node, vector<node>, function<bool(node, node)>> pq(compare);
  unordered_set<int> idx;
  for (int i = 1; i <= n; i++) {
    int mod = cost[i] % 100;
    if (mod == 0) continue;
    pq.push(node{i, weight[i] * 1LL * (100 - mod)});
    m -= mod;
    if (m < 0) {
      m += 100;
      ans += pq.top().val;
      idx.insert(pq.top().idx);
      pq.pop();
    }
  }
  cout << ans << "\n";
  for (int i = 1; i <= n; i++) {
    if (idx.find(i) != idx.end()) {
      cout << ceil(cost[i] / (double)100) << " 0\n";
    } else
      cout << cost[i] / 100 << " " << cost[i] % 100 << "\n";
  }
}
