#include <bits/stdc++.h>
using namespace std;
pair<int, int> arr[100005], cost[100005];
priority_queue<pair<int, int> > pq;
int main() {
  int n, i;
  long long m;
  pair<int, int> p;
  scanf("%d %I64d", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%d", &arr[i].first);
  }
  for (i = 0; i < n; i++) {
    scanf("%d", &arr[i].second);
  }
  long long ans = 0;
  for (i = 0; i < n; i++) {
    if (arr[i].first % 100 == 0) {
      cost[i].first = arr[i].first / 100;
    } else if (m >= arr[i].first % 100) {
      m = m - arr[i].first % 100;
      cost[i].second = arr[i].first % 100;
      cost[i].first = arr[i].first / 100;
      p.second = i;
      p.first = (100 - arr[i].first % 100);
      p.first = -p.first * arr[i].second;
      pq.push(p);
    } else if (pq.size() == 0 || (-pq.top().first >=
                                  arr[i].second * (100 - arr[i].first % 100))) {
      ans = ans + arr[i].second * (100 - arr[i].first % 100);
      cost[i].first = 1 + arr[i].first / 100;
      m = m + (100 - arr[i].first % 100);
    } else {
      p = pq.top();
      pq.pop();
      ans = ans - p.first;
      m = m + (100 - arr[i].first % 100);
      cost[p.second].first++;
      cost[p.second].second = 0;
      cost[i].second = arr[i].first % 100;
      cost[i].first = arr[i].first / 100;
      p.second = i;
      p.first = (100 - arr[i].first % 100);
      p.first = -p.first * arr[i].second;
      pq.push(p);
    }
  }
  printf("%I64d", ans);
  for (i = 0; i < n; i++) {
    printf("\n%d %d", cost[i].first, cost[i].second);
  }
  return 0;
}
