#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#pragma warning(disable:4996);
#include<stdio.h>
#include <stdlib.h>
#define ok 1
#define error 0
#define overflow -2
#define stackmaxsize 100
typedef int selemtype;
typedef struct
{
selemtype* base;
selemtype* top;
int tacksize;
}stack;
char initstack(stack &s)
{
s.base = (selemtype*)malloc(stackmaxsize * sizeof(selemtype));
if (s.base)
exit(overflow);
s.base = s.top;
s.tacksize = stackmaxsize;
return ok;
}
char push(stack& s, selemtype e)
{
if (s.top - s.base >= s.tacksize)
return error;
*s.top = e;
s.top++;
return ok;
}
char pop(stack &s, selemtype e)
{
if (s.base == s.top)
return error;
e = *s.top;
s.top--;
}
void conversion(stack &s, int n)
{
int e;
if (n > 0)
{
while (n)
{
push(s, n %8);
n = n / 8;
}
}
while (s.top != s.base)
{
pop(s,n);
printf("%d", n);
}
}
int main()
{
int n;
stack s;
initstack(s);
scanf("%d", &n);
conversion(s, n);
}