import kotlin.random.Random
import kotlin.random.nextInt

fun main(args: Array<String>) {
    fun String.toIntRange(): IntRange {
        val (from, to) = this.split("..").map { it.toInt() }
        return from..to
    }
    val MAX = 100_000
    val n = args[0].toInt()
    val fromRange = args[1].toIntRange()
    val toRange = args[2].toIntRange()
    val tests = mutableListOf<String>()
    var sum = 0
    for (fromRod in fromRange) {
        for (toRod in toRange) {
            if (sum + n <= MAX) {
                sum += n
                tests.add("$n")
                tests.add(generateSequence { fromRod }.take(n).joinToString(" "))
                tests.add(generateSequence { toRod }.take(n).joinToString(" "))
            }
        }
    }
    println(tests.size / 3)
    for (line in tests) {
        println(line)
    }
}
