#include<iostream>
using namespace std;
int main()
{
char a[6];
cout << "#";
for (int i = 0; i < 6; i++)
{
cin >>a[i];
}
cout << endl << "#";
for (int i = 0; i < 6; i++)
{
if (a[i] == '0')cout << 'F';
if (a[i] == '1')cout << 'E';
if (a[i] == '2')cout << 'D';
if (a[i] =='3')cout << 'C';
if (a[i] == '4')cout << 'B';
if (a[i] == '5')cout << 'A';
if (a[i] == '6')cout << '9';
if (a[i] == '7')cout << '8';
if (a[i] == '8')cout << '7';
if (a[i] == '9')cout << '6';
if (a[i] == 'A')cout << '5';
if (a[i] == 'B')cout << '4';
if (a[i] == 'C')cout << '3';
if (a[i] == 'D')cout << '2';
if (a[i] == 'E')cout << '1';
if (a[i] == 'F')cout << '0';
}
return 0;
}