import java.util.*;
import java.net.*;
import java.io.*;
import java.text.DateFormat;

public class Client868 {
    public static void main(String [] args) {
        Socket sock=null;
        try {
  	  sock=new Socket(args[0],37);
	  byte [] inarrayb=new byte[4];
	  int [] inarray=new int[4];
	  Date date=new Date();
	  long tick;
          InputStream is=sock.getInputStream();
	  is.read(inarrayb);
// convert array to integers
	  for (int i=0;i<4;i++) {
	      inarray[i]=inarrayb[i];
	      inarray[i]&=0xFF;
	  }
	  int tmp=inarray[0];
// make positive
	  inarray[0]&=0x7F;
	  tick=(inarray[0]<<24)+(inarray[1]<<16)+(inarray[2]<<8)+inarray[3];
	  long adj=2208988800L;
// if original number was >=0x80000000, adjust the adjustment 
   	  if ((tmp&0x80)==0x80) {
            adj-=0x7FFFFFFF;
            adj--;
	    }
          tick-=adj; // convert between 1900/1970
	  tick*=1000;  // convert to mS
          date.setTime(tick);
  	  DateFormat df=DateFormat.getDateTimeInstance(
	     DateFormat.FULL,DateFormat.FULL);
	  System.out.println(df.format(date));
	}
	catch (IOException e) {
	    System.out.println(e);
	    return;
	}
	finally {
	    try {
              sock.close();
	    }
	    catch (IOException e) {}
	}
    }
}
  
