/**
 * The function calculates the total number of pages required to print a graphic design based on the height, width, and margin of the design.
 *
 * @param height the height of the design (in inches)
 * @param width the width of the design (in inches)
 * @param margin the margin size (in inches)
 * @return The total number of pages required to print the design.
 *
 * Example:
 * total_pages(10, 8, 0.5) -> 35
 */
fun totalPages(height: Double, width: Double, margin: Double): Int {

    // Calculate the printable height and width by subtracting the margins
    val printableHeight = height - 2 * margin
    val printableWidth = width - 2 * margin

    // Calculate the number of pages required to print the design
    val (rows, leftoverHeight) = printableHeight.div(11.0).toInt() to printableHeight.rem(11.0)
    val (columns, leftoverWidth) = printableWidth.div(8.5).toInt() to printableWidth.rem(8.5)

    // If there's some leftover height or width, we need an additional page
    var totalRows = rows
    var totalColumns = columns
    if (leftoverHeight >= 0.001) {
        totalRows++
    }
    if (leftoverWidth >= 0.001) {
        totalColumns++
    }

    // Return the total
    return totalRows * totalColumns
}
/**
 * The function calculates the total number of pages required to print a graphic design based on the height, width, and margin of the design.
 *
 * @param height the height of the design (in inches)
 * @param width the width of the design (in inches)
 * @param margin the margin size (in inches)
 * @return The total number of pages required to print the design.
 *
 * Example:
 * total_pages(10, 8, 0.5) -> 35
 */
fun totalPages(height: Double, width: Double, margin: Double): Int {
/**
 * The function calculates the total number of pages required to print a graphic design based on the height, width, and margin of the design.
 *
 * @param height the height of the design (in inches)
 * @param width the width of the design (in inches)
 * @param margin the margin size (in inches)
 * @return The total number of pages required to print the design.
 *
 * Example:
 * total_pages(10, 8, 0.5) -> 35
 */
fun totalPages(height: Double, width: Double, margin: Double): Int {

    // Calculate the printable height and width by subtracting the margins
    val printableHeight = height - 2 * margin
    val printableWidth = width - 2 * margin

    // Calculate the number of pages required to print the design
    val (rows, leftoverHeight) = printableHeight.div(11.0).toInt() to printableHeight.rem(11.0)
    val (columns, leftoverWidth) = printableWidth.div(8.5).toInt() to printableWidth.rem(8.5)

    // If there's some leftover height or width, we need an additional page
    var totalRows = rows
    var totalColumns = columns
    if (leftoverHeight >= 0.001) {
        totalRows++
    }
    if (leftoverWidth >= 0.001) {
        totalColumns++
    }

    // Return the total
    return totalRows * totalColumns
}