#include <bits/stdc++.h>
template <typename Arg1>
void functionHelper0(const char* name, Arg1&& arg1) {
  std::cout << name << " = " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void functionHelper0(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cout.write(names, comma - names) << " = " << arg1;
  functionHelper0(comma, args...);
}
template <typename T>
inline T readInt() {
  T n = 0, s = 1;
  char p = getchar();
  if (p == '-') s = -1;
  while ((p < '0' || p > '9') && p != EOF && p != '-') p = getchar();
  if (p == '-') s = -1, p = getchar();
  while (p >= '0' && p <= '9') {
    n = (n << 3) + (n << 1) + (p - '0');
    p = getchar();
  }
  return n * s;
}
template <typename Out>
void split(const std::string& s, char delim, Out result) {
  std::stringstream ss;
  ss.str(s);
  std::string item;
  while (std::getline(ss, item, delim)) {
    *(result++) = item;
  }
}
std::vector<std::string> split(const std::string& s, char delim) {
  std::vector<std::string> elems;
  split(s, delim, std::back_inserter(elems));
  return elems;
}
using namespace std;
void ans() {
  int n = readInt<int>(), m = readInt<int>();
  vector<int> c(n), w(n);
  for (int i = (0); i < (n); i++) {
    c[i] = readInt<int>();
  }
  for (int i = (0); i < (n); i++) w[i] = readInt<int>();
  vector<int> cost(n, 0);
  for (int i = (0); i < (n); i++) {
    if (c[i] % 100) cost[i] = -(100 - c[i] % 100) * w[i];
  }
  int need = 0;
  priority_queue<pair<int, int>> heap;
  for (int i = (0); i < (n); i++) {
    need += c[i] % 100;
  }
  {
    if (0) {
      functionHelper0("need", need);
    }
  };
  need = (need - m - 1) / 100 + 1;
  {
    if (0) {
      functionHelper0("need", need);
    }
  };
  long long r = 0;
  vector<bool> needChange(n);
  int curr = m, i = 0;
  for (; i < n; i++) {
    if (need <= 0) break;
    if (cost[i] != 0) {
      {
        if (0) {
          functionHelper0("i, cost[i]", i, cost[i]);
        }
      };
      heap.push({cost[i], i});
    }
    curr -= c[i] % 100;
    if (curr >= 0) {
      continue;
    }
    {
      if (0) {
        functionHelper0("i, curr", i, curr);
      }
    };
    int index = heap.top().second;
    r += heap.top().first;
    needChange[index] = true;
    heap.pop();
    {
      if (0) {
        functionHelper0("index", index);
      }
    };
    curr += 100;
    need--;
    {
      if (0) {
        functionHelper0("curr", curr);
      }
    };
  }
  cout << -r << endl;
  for (int i = (0); i < (n); i++) {
    int count = c[i] / 100;
    int left = c[i] % 100;
    if (needChange[i]) {
      cout << count + 1 << " " << 0 << endl;
    } else {
      cout << count << " " << left << endl;
    }
  }
}
int main() {
  ans();
  return 0;
}
