#include <bits/stdc++.h>
using namespace std;
struct st {
  long long money, num, c, place;
  bool operator<(const st& x) const {
    return c * (100 - money) > x.c * (100 - x.money);
  }
  st() {}
  st(long long a, long long b, long long o, long long y) {
    money = a, num = b, c = o, place = y;
  }
};
priority_queue<st> Q;
long long money[100005], c[100005];
bool vis[100005];
int main() {
  long long n, m, ans = 0;
  scanf("%lld %lld", &n, &m);
  for (long long i = 1; i <= n; i++) scanf("%lld", &money[i]);
  for (long long i = 1; i <= n; i++) scanf("%lld", &c[i]);
  for (long long i = 1; i <= n; i++) {
    if (money[i] % 100 != 0)
      Q.push(st(money[i] % 100, money[i] / 100, c[i], i));
    if ((money[i] % 100) <= m)
      m -= (money[i] % 100);
    else {
      m += 100;
      m -= (money[i] % 100);
      st k = Q.top();
      vis[k.place] = 1;
      ans += (k.c * (100 - k.money));
      Q.pop();
    }
  }
  printf("%lld\n", ans);
  for (long long i = 1; i <= n; i++) {
    if (vis[i])
      printf("%lld %lld\n", (money[i] + 99) / 100, 0);
    else
      printf("%lld %lld\n", money[i] / 100, money[i] % 100);
  }
  return 0;
}
