#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void cut_0(char *s)//cuts the zeroes from the left side
{
    while ((s[0]=='0') && (strlen(s)!=1))
    {
        int j;
        for (j=0;j<=strlen(s)-1;j++)
        {
            s[j]=s[j+1];
        }
    }
}

int main()
{
    char temp[]="0 0 0";
    char found[15][10];
    int k=0;
    while (0==0)
    {
        char s[10];
        scanf(" %[^\n]s",s);
        int i;
        if (strcmp(s,temp)==0)
        {
            break;
        }
        for (i=0;i<strlen(s)-4;i++)
        {
            if (s[i]==s[strlen(s)-3])
            {
                s[i]=s[strlen(s)-1];
            }
        }
        s[strlen(s)-4]='\0';
        for (i=0;i<=strlen(s);i++)
        {
            found[k][i]=s[i];
        }
        cut_0(found[k]);
        k++;
    }
    int i;
    for (i=0;i<k;i++)
    {
        printf("%s\n",found[i]);
    }
    return 0;
}