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

public class Client868big {
    public static void main(String [] args) {
        Socket sock=null;
        try {
  	  sock=new Socket(args[0],37);
	  byte [] inarray=new byte[5];
	  Date date=new Date();
          InputStream is=sock.getInputStream();
	  is.read(inarray,1,4);
	  BigInteger tick;
	  inarray[0]=0; // make sure number is positive
	  tick = new BigInteger(inarray);
	  //number of second between 1900 and 1970
  // convert between 1900/1970
tick=tick.subtract(new BigInteger("2208988800"));	       
// convert to mS
tick=tick.multiply(new BigInteger("1000")); 
         date.setTime(tick.longValue());
  	  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) {}
	}
    }
}
