Problem: You are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In 12-hours format hours change from 1 to 12, while in 24-hours it changes from 0 to 23. In both formats minutes change from 0 to 59.

You are given a time in format HH:MM that is currently displayed on the broken clock. Your goal is to change minimum number of digits in order to make clocks display the correct time in the given format.

For example, if 00:99 is displayed, it is enough to replace the second 9 with 3 in order to get 00:39 that is a correct time in 24-hours format. However, to make 00:99 correct in 12-hours format, one has to change at least two digits. Additionally to the first change one can replace the second 0 with 1 and obtain 01:39.

Input

The first line of the input contains one integer 12 or 24, that denote 12-hours or 24-hours format respectively.

The second line contains the time in format HH:MM, that is currently displayed on the clock. First two characters stand for the hours, while next two show the minutes.

Output

The only line of the output should contain the time in format HH:MM that is a correct time in the given format. It should differ from the original in as few positions as possible. If there are many optimal solutions you can print any of them.

Examples

Input

24
17:30


Output

17:30


Input

12
17:30


Output

07:30


Input

24
99:99


Output

09:09

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
bool is_prime(long long x) {
  if (x == 1) return false;
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) return false;
  return true;
}
bool is_palindrome(string s1) {
  int l = s1.length();
  for (int i = 0; i < l / 2; i++)
    if (s1[i] != s1[l - i - 1]) return false;
  return true;
}
unsigned long long C(long long n, long long k) {
  if (k == 0) return 1;
  return (n * C(n - 1, k - 1)) / k;
}
long long modular_pow(long long base, long long exponent, int modulus) {
  long long result = 1;
  while (exponent > 0) {
    if (exponent % 2 == 1) result = (result * base) % modulus;
    exponent = exponent >> 1;
    base = (base * base) % modulus;
  }
  return result;
}
long long binaryToDec(string number) {
  long long result = 0, pow = 1;
  for (int i = number.length() - 1; i >= 0; --i, pow <<= 1)
    result = (result + (number[i] - '0') * pow) % 1000003;
  return result;
}
long long binaryToDec2(string number) {
  long long result = 0, pow = 1;
  int l = number.length();
  for (int i = 0; i < l; ++i, pow <<= 1)
    result = (result + (number[i] - '0') * pow) % 1000003;
  return result;
}
string decimalToBin(int number) {
  if (number == 0) return "0";
  if (number == 1) return "1";
  if (number % 2 == 0)
    return decimalToBin(number / 2) + "0";
  else
    return decimalToBin(number / 2) + "1";
}
unsigned long long GCD(unsigned long long a, unsigned long long b) {
  return b == 0 ? a : GCD(b, a % b);
}
int cntMask(int mask) {
  int ret = 0;
  while (mask) {
    if (mask % 2) ret++;
    mask /= 2;
  }
  return ret;
}
int getBit(int mask, int i) { return ((mask >> i) & 1) == 1; }
int setBit(int mask, int i, int value = 1) {
  return (value) ? mask | (1 << i) : (mask & ~(1 << i));
}
unsigned long long mystoi(string s) {
  unsigned long long ans = 0;
  unsigned long long po = 1;
  for (int i = s.length() - 1; i >= 0; i--) {
    ans += (s[i] - '0') * po;
    po *= 10;
  }
  return ans;
}
string conv(int i) {
  string t = "";
  while (i) {
    t += '0' + (i % 10);
    i /= 10;
  }
  return t;
}
bool hasZero(int i) {
  if (i == 0) return true;
  while (i) {
    if (i % 10 == 0) return true;
    i /= 10;
  }
  return false;
}
bool isSortedAc(int a[], int n) {
  for (int i = 0; i < int(n - 1); i++)
    if (a[i] > a[i + 1]) return false;
  return true;
}
bool isSortedDec(int a[], int n) {
  for (int i = 0; i < int(n - 1); i++)
    if (a[i] < a[i + 1]) return false;
  return true;
}
bool cmp(int i, int j) { return i > j; }
int vo(string s) {
  int ret = 0;
  for (int i = 0; i < int(s.length()); i++) {
    if (s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' ||
        s[i] == 'u' || s[i] == 'y')
      ret++;
  }
  return ret;
}
void solveB() {
  int n;
  int p[100 + 5];
  string w[100 + 5];
  cin >> n;
  for (int i = 0; i < int(n); i++) cin >> p[i];
  getchar();
  for (int i = 0; i < int(n); i++) getline(cin, w[i]);
  for (int i = 0; i < int(n); i++)
    if (vo(w[i]) != p[i]) {
      cout << "NO" << endl;
      return;
    }
  cout << "YES" << endl;
  return;
}
vector<int> hit;
int n;
int a[100000 + 5];
long long sums[100000 + 5] = {0};
long long getmax(int i, int j) {
  if (i >= j) return a[j];
  int it = lower_bound(hit.begin(), hit.end(), i) - hit.begin();
  if (it == n || hit[it] >= j) return sums[j] - sums[i] + a[i];
  return max(getmax(i, max(0, hit[it] - 1)),
             getmax(min(hit[it] + 1, n - 1), j));
}
int main() {
  int n;
  string s;
  cin >> n >> s;
  if (n == 12) {
    if (s[0] - '0' > 1 && s[1] - '0' > 0)
      s[0] = '0';
    else if (s[0] - '0' > 1 && s[1] == '0')
      s[0] = '1';
    else if (s[0] == '0' && s[1] == '0')
      s[1] = '1';
    else if (s[0] == '1' && s[1] - '0' >= 2)
      s[1] = '2';
    if (s[3] - '0' > 5) s[3] = '5';
  } else {
    if (s[0] - '0' > 2)
      s[0] = '0';
    else if (s[0] == '2' && s[1] - '0' >= 4)
      s[1] = '3';
    if (s[3] - '0' > 5) s[3] = '5';
  }
  cout << s << endl;
  return 0;
}