The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. In response an SMS activation code arrives.

A young hacker Vasya disassembled the program and found the algorithm that transforms the shown number into the activation code. Note: it is clear that Vasya is a law-abiding hacker, and made it for a noble purpose — to show the developer the imperfection of their protection.

The found algorithm looks the following way. At first the digits of the number are shuffled in the following order <first digit><third digit><fifth digit><fourth digit><second digit>. For example the shuffle of 12345 should lead to 13542. On the second stage the number is raised to the fifth power. The result of the shuffle and exponentiation of the number 12345 is 455 422 043 125 550 171 232. The answer is the 5 last digits of this result. For the number 12345 the answer should be 71232.

Vasya is going to write a keygen program implementing this algorithm. Can you do the same?

Input

The only line of the input contains a positive integer five digit number for which the activation code should be found.

Output

Output exactly 5 digits without spaces between them — the found activation code of the program.

Examples

Input

12345


Output

71232
#include <bits/stdc++.h>
const long long M = 1e12;
const long long N = 1e5 + 5;
using namespace std;
long long max(long long a, long long b) {
  if (a >= b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a <= b)
    return a;
  else
    return b;
}
long long diff(long long a, long long b) {
  if (a >= b)
    return a - b;
  else
    return b - a;
}
long long isPrime(long long n) {
  if (n < 2) return 0;
  if (n < 4) return 1;
  if (n % 2 == 0 or n % 3 == 0) return 0;
  for (long long i = 5; i * i <= n; i += 6)
    if (n % i == 0 or n % (i + 2) == 0) return 0;
  return 1;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void sort(long long arr[], long long n) {
  for (long long i = 0; i <= n; i++) {
    for (long long j = i; j <= n; j++) {
      if (arr[i] > arr[j]) {
        long long t = arr[i];
        arr[i] = arr[j];
        arr[j] = t;
      }
    }
  }
}
long long modd(long long n, long long m) {
  if (n - m > 0) {
    return n - m;
  } else {
    return m - n;
  }
}
long long fact(long long n) {
  if (n == 1) {
    return 1;
  } else {
    return n * fact(n - 1);
  }
}
long long mod(long long n) {
  if (n >= 0) {
    return n;
  } else {
    return -n;
  }
}
long long isperfectsquare(long long n) {
  long long k = sqrt(n);
  if (n % k == 0 && n / k == k) {
    return 1;
  } else {
    return 0;
  }
}
void pairsort(long long a[], long long b[], long long n) {
  pair<long long, long long> pairt[n];
  for (long long i = 0; i < n; i++) {
    pairt[i].first = a[i];
    pairt[i].second = b[i];
  }
  sort(pairt, pairt + n);
  for (long long i = 0; i < n; i++) {
    a[i] = pairt[i].first;
    b[i] = pairt[i].second;
  }
}
long long ispalindrome(string s) {
  long long palindrome = 1;
  long long n = s.length();
  for (long long i = 0; i < (n / 2); i++) {
    if (s[i] != s[n - 1 - i]) {
      palindrome = 0;
      break;
    }
  }
  return palindrome;
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
string longsum(string n1, string n2) {
  string s1 = "";
  string s2 = "";
  long long carry = 0;
  long long n = min(n1.length(), n2.length());
  if (n1.length() != n2.length()) {
    if (n1.length() == n) {
      long long diff = n2.length() - n;
      while (diff--) {
        s2 += '0';
      }
      for (long long i = 0; i < n1.length(); i++) {
        s2 += n1[i];
      }
      n1 = s2;
      s2 = "";
    } else {
      long long diff = n1.length() - n;
      while (diff--) {
        s2 += '0';
      }
      for (long long i = 0; i < n2.length(); i++) {
        s2 += n2[i];
      }
      n2 = s2;
      s2 = "";
    }
  }
  long long length = max(n1.length(), n2.length());
  for (long long i = length - 1; i >= 0; i--) {
    long long sum = n1[i] - 48 + n2[i] - 48 + carry;
    carry = sum / 10;
    s1 += (sum % 10) + 48;
  }
  if (carry) {
    s2 += (carry + 48);
  }
  for (long long i = 0; i < length; i++) {
    s2 += s1[length - i - 1];
  }
  return s2;
}
long long lcompstr(string s1, string s2) {
  if (s1.length() != s2.length()) {
    if (s1.length() > s2.length()) {
      return 1;
    } else {
      return 0;
    }
  } else {
    for (long long i = 0; i < s1.length(); i++) {
      if (s1[i] > s2[i]) {
        return 1;
      } else if (s1[i] < s2[i]) {
        return 0;
      }
    }
  }
  return 1;
}
long long gcdExtended(long long a, long long b, long long *x, long long *y) {
  if (a == 0) {
    *x = 0, *y = 1;
    return b;
  }
  long long x1, y1;
  long long gcd = gcdExtended(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
long long modInverse(long long a, long long m) {
  long long x, y;
  long long g = gcdExtended(a, m, &x, &y);
  if (g != 1) cout << "Inverse doesn't exist";
  long long res = (x % m + m) % m;
  return res;
}
void add1(long long &a, long long b) {
  a = a + b;
  if (a >= 1000000007) {
    a = a - 1000000007;
  }
}
long long idb(long long i, long long j, long long k) {
  long long num = i * 100 + j * 10 + k;
  if (num % 8 == 0) {
    return 1;
  } else {
    return 0;
  }
}
long long isdiv(long long n, long long k) {
  while (n % k == 0) {
    n /= k;
  }
  if (n == 1) {
    return 1;
  } else {
    return 0;
  }
}
long long binpow(long long a, long long b) {
  long long ans = 1;
  while (b != 0) {
    if (b & 1) {
      ans = ans * a;
    }
    a = a * a;
    b = b >> 1;
  }
  return ans;
}
int32_t main() {
  string s;
  cin >> s;
  long long num =
      ((s[0] - '0') * binpow(10, 4)) + ((s[2] - '0') * binpow(10, 3)) +
      ((s[4] - '0') * binpow(10, 2)) + ((s[3] - '0') * binpow(10, 1)) +
      ((s[1] - '0') * binpow(10, 0));
  long long ans = 1;
  long long m = 5;
  while (m--) {
    ans = (ans * num) % (100000);
  }
  if (ans == 0) {
    cout << "00000";
  } else {
    cout << ans;
  }
  return 0;
}
