#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long c[105000];
long long w[105000];
long long s[105000];
int main() {
  scanf("%lld%lld", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%lld", &c[i]);
  for (int i = 1; i <= n; i++) scanf("%lld", &w[i]);
  long long dis = 0;
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      pq;
  for (int i = 1; i <= n; i++) {
    if (c[i] % 100 == 0) {
      s[i] = c[i] / 100;
    } else {
      s[i] = c[i] / 100;
      m -= (c[i] - s[i] * 100);
      pq.push(make_pair(w[i] * (100 - c[i] + s[i] * 100), i));
      if (m < 0) {
        m += 100;
        pair<long long, long long> tmp = pq.top();
        pq.pop();
        dis += tmp.first;
        s[tmp.second]++;
      }
    }
  }
  printf("%lld\n", dis);
  for (int i = 1; i <= n; i++) {
    printf("%lld ", s[i]);
    if (s[i] * 100 < c[i])
      printf("%lld\n", c[i] - s[i] * 100);
    else
      printf("0\n");
  }
}
