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

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.regex.*;
/* 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
	{
		int width = 10, height = 5;
		String regex = "@(\\d+)\\R([01]{"+width+"}\\R??){"+height+"}";
		String text = "@200\r\n" + 
				"0000000000\r\n" + 
				"0000011001\r\n" + 
				"1100100000\r\n" + 
				"0101001101\r\n" + 
				"1110001110\r\n" + 
				"\r\n" + 
				"@500\r\n" + 
				"0000000000\r\n" + 
				"0000011001\r\n" + 
				"1100100000\r\n" + 
				"0101001101\r\n" + 
				"1110001110\r\n" + 
				"";
		Pattern p = Pattern.compile(regex);
		Matcher m = p.matcher(text);
		while(m.find()){
			System.out.println(m.group());
			System.out.println("----------");
		}
	}
}