#include <stdio.h>
#include <math.h>
#include <stdlib.h>
void tentoeight(n){
int a[10000];
int res=n;
int i=0,j;
while(res!=0){
a[i]=res%8;
res=res/8;
i++;
}
for(j=i-1;j>=0;j--){
printf("%d",a[j]);}
printf("\n");
}
int main()
{
int n;
while(scanf("%d",&n)!=EOF){
tentoeight(n);
}
return 0;
}
#include <math.h>
#include <stdlib.h>
void tentoeight(n){
int a[10000];
int res=n;
int i=0,j;
while(res!=0){
a[i]=res%8;
res=res/8;
i++;
}
for(j=i-1;j>=0;j--){
printf("%d",a[j]);}
printf("\n");
}
int main()
{
int n;
while(scanf("%d",&n)!=EOF){
tentoeight(n);
}
return 0;
}