#include <bits/stdc++.h>
using namespace std;
long long n, m, s;
long long c[1000010], w[1000010], k[1000010];
long long zhi[1000010], ying[1000010];
struct node {
  long long x, y;
  bool operator<(const node &xx) const { return xx.x < x; }
};
priority_queue<node> a;
node aaa;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
    k[i] = c[i] % 100;
    zhi[i] = c[i] / 100;
  }
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= n; i++)
    if (k[i] != 0) {
      aaa.x = (100 - k[i]) * w[i];
      aaa.y = i;
      a.push(aaa);
      ying[i] = k[i];
      m -= k[i];
      if (m < 0) {
        m += 100;
        zhi[a.top().y]++;
        ying[a.top().y] = 0;
        s += a.top().x;
        a.pop();
      }
    }
  cout << s << endl;
  for (int i = 1; i <= n; i++) cout << zhi[i] << " " << ying[i] << endl;
  return 0;
}
