#include <bits/stdc++.h>
using namespace std;
int main() {
  int num[56] = {}, ans[56] = {}, tmp[56];
  const int shuf[] = {1, 3, 4, 2, 0};
  string s;
  cin >> s;
  for (int i = 0; i < 5; ++i) {
    num[i] = s[shuf[i]] - '0';
  }
  ans[0] = 1;
  for (int ks = 0; ks < 5; ++ks) {
    memset(tmp, 0, sizeof(tmp));
    for (int i = 0; i < 55; ++i) {
      for (int j = 0; j < 5; ++j) {
        if (i + j >= 55) continue;
        tmp[i + j] += ans[i] * num[j];
      }
    }
    for (int i = 0; i < 55; ++i) {
      tmp[i + 1] += tmp[i] / 10;
      tmp[i] %= 10;
    }
    for (int i = 0; i < 55; ++i) {
      ans[i] = tmp[i];
    }
  }
  bool f = false;
  for (int i = 4; i >= 0; --i) {
    cout << ans[i];
  }
  cout << endl;
  return 0;
}
