// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

string f(char c) {
  if (c == ' ') return "101";
  if (c == '\'') return "000000";
  if (c == ',') return "000011";
  if (c == '-') return "10010001";
  if (c == '.') return "010001";
  if (c == '?') return "000001";
  if (c == 'A') return "100101";
  if (c == 'B') return "10011010";
  if (c == 'C') return "0101";
  if (c == 'D') return "0001";
  if (c == 'E') return "110";
  if (c == 'F') return "01001";
  if (c == 'G') return "10011011";
  if (c == 'H') return "0100000";
  if (c == 'I') return "0111";
  if (c == 'J') return "10011000";
  if (c == 'K') return "0110";
  if (c == 'L') return "00100";
  if (c == 'M') return "10011001";
  if (c == 'N') return "10011110";
  if (c == 'O') return "00101";
  if (c == 'P') return "111";
  if (c == 'Q') return "10011111";
  if (c == 'R') return "1000";
  if (c == 'S') return "00110";
  if (c == 'T') return "00111";
  if (c == 'U') return "10011100";
  if (c == 'V') return "10011101";
  if (c == 'W') return "000010";
  if (c == 'X') return "10010010";
  if (c == 'Y') return "10010011";
  if (c == 'Z') return "10010000";
}

char g(int x) {
  static string v = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
  return v[x];
}

main {
  string s, t;
  while (getline(cin, t)) s += t + " ";
  s.pop_back();
  string x;
  for (auto &c : s) x += f(c);
  x += string((5 - x.size() % 5) % 5, '0');
  string r;
  rep(i, x.size() / 5) r += g(stoi(x.substr(i * 5, 5), nullptr, 2));
  cout << r << endl;
}