Problem:
Score : 100 points

Problem Statement

Decades have passed since the beginning of AtCoder Beginner Contest.

The contests are labeled as ABC001, ABC002, ... from the first round, but after the 999-th round ABC999, a problem occurred: how the future rounds should be labeled?

In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: ABD001, ABD002, ..., ABD999.

You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.

Constraints

1 \leq N \leq 1998

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.

Sample Input 1

999

Sample Output 1

ABC

The 999-th round of AtCoder Beginner Contest is labeled as ABC999.

Sample Input 2

1000

Sample Output 2

ABD

The 1000-th round of AtCoder Beginner Contest is labeled as ABD001.

Sample Input 3

1481

Sample Output 3

ABD

The 1481-th round of AtCoder Beginner Contest is labeled as ABD482.

Solution in C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
using System.Collections.Generic;

namespace bla
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			int n = int.Parse (Console.ReadLine ());
			values = new List<int> ();
			values.Add (1);
			int nine = 9;
			while (nine <= n) {
				values.Add (nine);
				nine *= 9;
			}
			int six = 6;
			while (six <= n) {
				values.Add (six);
				six *= 6;
			}
			values.Sort ();
			values.Reverse ();

			Console.WriteLine (coins(n));
		}
		static List<int> values;
		static int[] dp = new int[100001];

		public static int coins(int v){
			if (v == 0)
				return 0;
			if (dp [v] != 0)
				return dp [v];
			int r = int.MaxValue;
			int i = 0;
			while (i < values.Count) {
				if (values [i] <= v) {
					r = Math.Min (r, coins (v - values [i]));
				}
				i++;
			}
			dp [v] = r + 1;
			return r + 1;
		}
	}
}