#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long double pi = acos(-1.0);
const string debug_line = "yolo";
const long double PI = acos((long double)-1.0);
const long double eps = 1e-6;
unsigned long long getRand() {
  return ((unsigned long long)rand() << 40) +
         ((unsigned long long)rand() << 20) + ((unsigned long long)rand());
}
long long c[100010];
long long w[100010];
bool marked[100010];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int(i) = (0); (i) < (n); ++(i)) {
    int temp;
    scanf("%d", &temp);
    c[i] = temp;
  }
  for (int(i) = (0); (i) < (n); ++(i)) {
    int temp;
    scanf("%d", &temp);
    w[i] = temp;
  }
  long long anger1 = 0;
  long long cost1 = 0;
  priority_queue<pair<pair<long long, long long>, long long>,
                 vector<pair<pair<long long, long long>, long long> >,
                 greater<pair<pair<long long, long long>, long long> > >
      Q1;
  for (int(i) = (0); (i) < (n); ++(i)) {
    long long req1 = c[i] % 100;
    if (m >= req1) {
      if (100 - req1 != 0 && req1 % 100 != 0) {
        Q1.push(make_pair(make_pair(w[i] * (100LL - req1), 100 - req1), i));
      }
      m -= req1;
    } else {
      bool poss = false;
      m -= req1;
      Q1.push(make_pair(make_pair(w[i] * (100LL - req1), 100 - req1), i));
      while (m < 0) {
        pair<pair<long long, long long>, long long> t1 = Q1.top();
        Q1.pop();
        anger1 += t1.first.first;
        marked[t1.second] = true;
        m += 100;
      }
    }
  }
  printf("%lld\n", anger1);
  for (int(i) = (0); (i) < (n); ++(i)) {
    if (marked[i]) {
      printf("%lld 0\n", c[i] / 100 + 1);
    } else {
      printf("%lld %lld\n", c[i] / 100, c[i] % 100);
    }
  }
  return 0;
}
