#include<iostream>
using namespace std;
typedef struct node
{
int data;
struct node *next;
} *stack;
void init(stack &s)
{ s=NULL;
}
int pop(stack &s)
{
int x;
x=s->data;
s=s->next;
return x;
}
void push(stack &s,int e)
{
stack p;
p=new node;
p->data=e;
p->next=s;
s=p;
}
int main()
{
int i,n;
stack s;
init(s);
while(cin>>n)
{ while(n)
{ push(s,n%5); n/=5;}
while(s)
cout<<pop(s);
cout<<endl;
}
return 0;
}