import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/* 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
	{
		final String regex = "(?m)^(A[0-9]{6})001";
		final String string = "A00233400193445 123394001\n\n"
	 + "A83485800193471 982001134";
		
		
		System.out.println(string.replaceAll(regex, "$1002"));
	}
}