int dirmode(int filemode)
{
  int result;
  result=filemode;
  if(filemode & 0400) result|=0100;
  if(filemode & 0040) result|=0010;
  if(filemode & 0004) result|=0001;
  return result;
}

void main()
{
  int i;
  scanf("%o",&i);
  printf("%o,%o\n",i,dirmode(i));
}
