/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;


import java.time.*;
import java.time.temporal.*;
import java.time.format.*;


/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{

        String input = "Mon, 13 Mar 2017 19:00:10 +0530 (IST)";
        int index = input.indexOf ( " (" ); // Note we are including the SPACE before the LEFT PARENTHESIS as we want to delete both characters.
        String inputModified = input.substring ( 0 , index );


        DateTimeFormatter f = DateTimeFormatter.ofPattern( "EEE, d MMM uuuu HH:mm:ss Z" );
        OffsetDateTime odt = OffsetDateTime.parse ( inputModified , f );

        Instant instant = odt.toInstant ();

        System.out.println ("inputModified: " + inputModified );
        System.out.println ("odt.toString(): " + odt );
        System.out.println ("instant.toString(): " + instant );
        
	}
}