public static void main ( String [] args ) {
	String [] data = null;  
	int a = 0;

	try{
	    File file = new File("file address");
	    if ( file.isFile() && file.exists() ) {
		InputStreamReader read = new InputStreamReader(new FileInputStream(file));
		BufferedReader bReader = new BufferedReader(read);
		String txt = null;
		while ((txt=bReader.readLine())!=null) {
		    data = txt.split(",");
		}
		read.close();
	    }

	}
	catch ( Exception e ) {
	    System.out.println("Error!");
	}

	for ( int i=0; i<data.length; i++ ) {
	    if ( data[i].charAt(0) == '"') {
		data[i]=data[i].substring(1,data[i].length());
	    }
	    if ( data[i].charAt(data[i].length()-1) == '"' ) {
		data[i]=data[i].substring(0, data[i].length()-1);
	    }
	}
	
	Arrays.sort(data);
	
	long res = 0;
	for ( int i=0; i<data.length; i++ ) {
	    a = 0;
	    for ( int j=0; j<data[i].length(); j++ ) {
		a = a + data[i].charAt(j)-64;
	    }
	    res += a*(i+1);
	}
 
	System.out.println("sum = " + res);
    }