#include<iostream>
#include<cstring>
#include<cstdio>
#define N 1<<20
using namespace std;

int k = 3;
char tek[N];

unsigned f ( string a ) {
	unsigned ans = 0;
	unsigned t = a[0] - '0';
	for ( int i = 1;i <= a.size();++i ) {
		if ( i == a.size() || a[i] == '.' ) { 
			ans <<= 8;
			ans |= t;
			t = 0;
		}
		else {
			t *= 10;
			t += a[i] - '0';
		}
	}
	unsigned sh = ans >> ( 32 - k );
	ans <<= k;
	ans |= sh;
	char b;
	b = ans >> 24;
	if ( b == '\a' ) return 0;
	printf ( "%c" , b );
	b = ans >> 16;
	if ( b == '\a' ) return 0;
	printf ( "%c" , b );
	b = ans >> 8;
	if ( b == '\a' ) return 0;
	printf ( "%c" , b );
	b = ans;
	if ( b == '\a' ) return 0;
	printf ( "%c" , b );
	return ans;
}

int main() {
	scanf ( "%d" , &k );
	while ( scanf ( "%s" , &tek ) != -1 ) f ( tek );
	cout << endl;
	return 0;
}
