#include <bits/stdc++.h>
using namespace std;
long long c[100005], w[100005];
pair<long long, long long> ans[100005];
struct comparellerval {
  bool operator()(pair<long long, long long> a, pair<long long, long long> b) {
    long long temp1 = 100 - c[a.second] % 100, temp2 = 100 - c[b.second] % 100;
    return (temp1 * a.first) < (temp2 * b.first);
  }
};
multiset<pair<long long, long long>, comparellerval> mt;
int main() {
  long long n, m, dis = 0;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) cin >> c[i];
  for (long long i = 0; i < n; i++) cin >> w[i];
  for (long long i = 0; i < n; i++) {
    ans[i].first = c[i] / 100;
    long long temp = c[i] % 100;
    if (temp) mt.insert({w[i], i});
    if (m >= temp) {
      m -= temp;
      ans[i].second = temp;
    } else {
      pair<long long, long long> P = *mt.begin();
      ans[P.second].first++;
      ans[P.second].second = 0;
      dis += w[P.second] * (100 - (c[P.second] % 100));
      mt.erase(mt.begin());
      if (P.second != i) {
        ans[i].second = temp;
        m += 100 - temp;
      } else
        m += (100 - temp);
    }
  }
  cout << dis << endl;
  for (long long i = 0; i < n; i++) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
}
