#include <string>
#include <iostream>
void addThousand(std::string& s) {
int size = s.size();
std::string fh = s.substr(0, size - 3);
std::string sh = s.substr(size - 3, 4);
if (fh == "")
{
s = "1" + sh;
}
else {
long long l = std::stoll(fh);
l++;
std::string ls = std::to_string(l);
s = ls + sh;
while (std::count(s.begin(), s.end(), '2') < 2)
{
l++;
ls = std::to_string(l);
s = ls + sh;
}
/*if (s[0] == '2' && fh[0] != '2')
{
int it = 1;
while (s[it] != '2') {
it++;
}
s[it] = '0';
}*/
}
}
void addHundred(std::string& s) {
int size = s.size();
if (s[size - 3] == '0')
{
if (s[size - 4] == '0')
{
s[size - 3] = '1';
}
else //if (s[size - 4] == '2')
{
std::string fh = s.substr(0, size - 3);
if (s[size - 4] == '1' && fh.find('0') != std::string::npos)
{
s[size - 3] = '1';
}
else
{
addThousand(s);
}
return;
}
}
else if (s[size - 3] == '9') {
s[size - 3] = '0';
addThousand(s);
return;
}
else
{
s[size - 3]++;
}
}
void addTen(std::string& s) {
int size = s.size();
if (s[size - 2] == '2')
{
if (s[size - 3] == '0')
{
addHundred(s);
return;
}
else if (s[size - 3] == '1')
{
s[size - 2] = '0';
addHundred(s);
return;
}
else if (s[size - 3] == '2')
{
s[size - 2]++;
}
else
{
addHundred(s);
}
}
else if (s[size - 2] == '9')
{
s[size - 2] = '2';
s[size - 3] = '3';
}
else {
s[size - 2]++;
}
}
void addOne(std::string& s) {
int size = s.size();
if (s[size - 1] == '1')
{
if (s[size - 2] == '0')
{
s[size - 1] = '0';
s[size - 2] = '1';
return;
}
else if (s[size - 2] == '1')
{
s[size - 1] = '2';
return;
}
else
{
addTen(s);
return;
}
}
else if (s[size - 1] == '9')
{
s[size - 1] = '1';
addTen(s);
}
else {
s[size - 1]++;
}
}
int main() {
int n;
std::cin >> n;
std::string s = "2021";
for (int i = 0; i < n - 1; i++)
{
addOne(s);
}
std::cout << s;
}