import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.net.HttpURLConnection;


	public class Articlepinger {
		
		public static void main(String[] args) throws IOException{
		
		String stockticker="GOOG";
		String url= "http://api.nytimes.com/svc/search/v2/articlesearch.json?q="+stockticker+"&api-key=ee261058272fbacfa18eceed8f929887:16:67655074";
		URL APIurl=null;
		try {
			APIurl = new URL(url);
		} catch (MalformedURLException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		HttpURLConnection request=null;
		try {
			request = (HttpURLConnection) APIurl.openConnection();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			request.setRequestMethod("GET");
		} catch (ProtocolException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		BufferedReader br=null;
		try {
			br= new BufferedReader(new InputStreamReader(request.getInputStream()));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String line=null;
		StringBuilder response=new StringBuilder();
		try {
			while((line=br.readLine()) != null){
				response.append(line + "\n");
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		//System.out.println(response.toString());
		
		String[] out = new String[500];
		if (response.toString().contains(":")){
			out = response.toString().split(":");
		}
		else {
			throw new IllegalArgumentException("Error!");
		}
		int i;
		for(i=0;i<out.length;i++){
		//System.out.println(out[i]);
		}
		//System.out.println(out.length);
		int val;
		val = Integer.parseInt(out[out.length - 3].substring(0,3));
		int point;
		point = (int) (val/100);
		System.out.println(point);
		
			}
		
		}
	
		