/* Generated by re2c */
// re2c $INPUT -o $OUTPUT -i --tags --input custom
#include <stddef.h>
#include <stdio.h>

static inline unsigned parse_oct(const char *s, const char *e)
{
    unsigned oct = 0;
    for (; s != e; ++s) {
        oct = oct * 10 + *s - '0';
    }
    return oct;
}

static void lex(const char *s)
{
#define YYPEEK()     *s
#define YYSKIP()     ++s
#define YYBACKUP()   marker = s
#define YYRESTORE()  s = marker
#define ZZTP(t)      t = s
#define ZZTN(t)      t = NULL
#define ZZRT(t)      s = t
    const char *marker, *p0, *p1, *p2, *p3;
    const char *zz_1;const char *zz_2;const char *zz_3;const char *zz_4;
    
{
	char yych;
	yych = YYPEEK();
	switch (yych) {
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9':
			ZZTP(zz_1);
			goto yy3;
		default: goto yy1;
	}
yy1:
	YYSKIP();
yy2:
	{ printf("error\n"); return; }
yy3:
	YYSKIP();
	YYBACKUP();
	yych = YYPEEK();
	switch (yych) {
		case '.':
			ZZTP(zz_2);
			goto yy4;
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9': goto yy6;
		default: goto yy2;
	}
yy4:
	YYSKIP();
	yych = YYPEEK();
	switch (yych) {
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9': goto yy7;
		default: goto yy5;
	}
yy5:
	YYRESTORE();
	goto yy2;
yy6:
	YYSKIP();
	yych = YYPEEK();
	switch (yych) {
		case '.':
			ZZTP(zz_2);
			goto yy4;
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9': goto yy8;
		default: goto yy5;
	}
yy7:
	YYSKIP();
	yych = YYPEEK();
	switch (yych) {
		case '.':
			ZZTP(zz_3);
			goto yy9;
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9': goto yy10;
		default: goto yy5;
	}
yy8:
	YYSKIP();
	yych = YYPEEK();
	switch (yych) {
		case '.':
			ZZTP(zz_2);
			goto yy4;
		default: goto yy5;
	}
yy9:
	YYSKIP();
	yych = YYPEEK();
	switch (yych) {
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9': goto yy11;
		default: goto yy5;
	}
yy10:
	YYSKIP();
	yych = YYPEEK();
	switch (yych) {
		case '.':
			ZZTP(zz_3);
			goto yy9;
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9': goto yy12;
		default: goto yy5;
	}
yy11:
	YYSKIP();
	yych = YYPEEK();
	switch (yych) {
		case '.':
			ZZTP(zz_4);
			goto yy13;
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9': goto yy14;
		default: goto yy5;
	}
yy12:
	YYSKIP();
	yych = YYPEEK();
	switch (yych) {
		case '.':
			ZZTP(zz_3);
			goto yy9;
		default: goto yy5;
	}
yy13:
	YYSKIP();
	yych = YYPEEK();
	switch (yych) {
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9': goto yy15;
		default: goto yy5;
	}
yy14:
	YYSKIP();
	yych = YYPEEK();
	switch (yych) {
		case '.':
			ZZTP(zz_4);
			goto yy13;
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9': goto yy17;
		default: goto yy5;
	}
yy15:
	YYSKIP();
	yych = YYPEEK();
	switch (yych) {
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9': goto yy18;
		default: goto yy16;
	}
yy16:
	p0 = zz_1;
	p1 = zz_2;
	p2 = zz_3;
	p3 = zz_4;
	{
            printf("%u.%u.%u.%u\n",
                parse_oct(p0, p1),
                parse_oct(p1 + 1, p2),
                parse_oct(p2 + 1, p3),
                parse_oct(p3 + 1, s));
            return;
        }
yy17:
	YYSKIP();
	yych = YYPEEK();
	switch (yych) {
		case '.':
			ZZTP(zz_4);
			goto yy13;
		default: goto yy5;
	}
yy18:
	YYSKIP();
	yych = YYPEEK();
	switch (yych) {
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9': goto yy19;
		default: goto yy16;
	}
yy19:
	YYSKIP();
	goto yy16;
}

}

int main(int argc, char **argv)
{
    for (int i = 1; i < argc; ++i) {
        lex(argv[i]);
    }
    return 0;
}
