fun main(args: Array<String>) {
    val reg = Regex(" ")
    var s = readLine()!!.split(reg)
    val n = s[0].toInt()
    var w = s[1].toLong()
    s = readLine()!!.split(reg)
    var a: List<Long> = (0..n - 1).map { s[it].toLong() }
    //a = a.sorted().reversed()
    val b: List<Long> = (0..n - 1).map { if (a[it] % 2 == 1L) (a[it] + 1) / 2 else a[it] / 2 }
    if (b.sum() > w)
        println(-1)
    else{
        w -= b.sum()
        var c: List<Pair<Long, Int>> = (0..n - 1).map { Pair(a[it], it) }
        c = c.sortedBy { it.first }.reversed()
        val ans = Array(n, {i -> 0L})
        var i = 0
        while (w > 0 && i < n){
            val pos = c[i].second
            ans[pos] = if (a[pos] < b[pos] + w) a[pos] else b[pos] + w
            w -= (ans[pos] - b[pos])
            ++i
        }
        if (w > 0)
            println(-1)
        else {
            for (j in 0..n - 1)
                print("${if (ans[j] == 0L) b[j] else ans[j]} ")
        }
    }
}

import java.lang.*
import java.util.*
import kotlin.collections.*
import kotlin.math.*

val read = Scanner(System.`in`)

fun main(){
    var n = read.nextInt()
    var w = read.nextInt()
    var a = Array<Pair<Int, Int>>(n){Pair(30, 5)}
    for (i in a.indices){
        var t = read.nextInt()
        a[i] = Pair(t, i)
    }
    a.sortByDescending { it.first }
    var b = Array<Pair<Int,Int>>(n){Pair(30, 5)}
    var Sum = 0
    for (i in a.indices){
        var t = ceil(a[i].first.toDouble() / 2).toInt()
        b[i] = Pair(t, a[i].second)
        Sum += t
    }

    if (Sum > w){
        print(-1)
    }
    else{
        var cont = w - Sum
        for (i in a.indices){
            //println("${b[i].first} $cont")
            if (b[i].first + cont > a[i].first){
                cont -= (a[i].first - b[i].first)
                b[i] = b[i].copy(first = a[i].first)
            }
            else{
                b[i] = b[i].copy(first = b[i].first + cont)
                cont = 0
            }
        }
        b.sortBy { it.second }
        for (i in b) print("${i.first} ")
    }
}

import java.util.*

fun main(vararg args: String) {

    data class Cup(val p: Int, val a: Int, var f: Int = 0)

    fun Int.halfUp() = (this + 1) shr 1

    with(Scanner(System.`in`)) {
        val n = nextInt()
        val w = nextInt()
        val cups = Array(n) { i -> Cup(i, nextInt()) }
        val halfSum = cups.sumBy { it.a.halfUp() }
        if (halfSum > w) println(-1)
        else {
            var extra = w - halfSum
            val s = cups.sortedBy { -it.a }
            var c = 0
            s.forEach {
                it.f = it.a.halfUp()
                val e = extra.coerceAtMost(it.a - it.f)
                it.f += e
                extra -= e
            }
            println(cups.joinToString(" ") { it.f.toString() })
        }
    }
}

fun debug(x: Any) {
  System.err.println(x)
}

fun main(args: Array<String>) {
  val (n, w) = readLine()!!.split(" ").map { it.toInt() }
  val a = readLine()!!.split(" ").map { it.toInt() }.toMutableList()
  val indexes = a.mapIndexed { index, x -> x to index }.sortedBy { it.first }.map { it.second }
  val sa = a.sorted()
  val b = IntArray(a.size)
  var rem = w
  for ((index, x) in sa.withIndex()) {
    val min = (x + 1) / 2
    if (rem < min) {
      println(-1)
      return
    }
    b[index] = min
    rem -= min
  }
  require(b.toList() == b.sorted())
  for (i in sa.size - 1 downTo 0) {
    val add = Math.min(sa[i] - b[i], rem)
    b[i] += add
    rem -= add
    if (rem == 0) {
      break
    }
  }
  val answer = b.mapIndexed { index, x -> indexes[index] to x }.sortedBy { it.first }.map { it.second }
  println(answer.joinToString(" "))
}

import java.lang.*
import java.util.*
import kotlin.collections.*
import kotlin.math.*

val read = Scanner(System.`in`)

fun main(){
    var n = read.nextInt()
    var w = read.nextInt()
    var a = Array<Pair<Int, Int>>(n){Pair(30, 5)}
    for (i in a.indices){
        var t = read.nextInt()
        a[i] = Pair(t, i)
    }
    a.sortByDescending { it.first }
    var b = Array<Pair<Int,Int>>(n){Pair(30, 5)}
    var Sum = 0
    for (i in a.indices){
        var t = ceil(a[i].first.toDouble() / 2).toInt()
        b[i] = Pair(t, a[i].second)
        Sum += t
    }

    if (Sum > w){
        print(-1)
    }
    else{
        var cont = w - Sum
        for (i in a.indices){
            //println("${b[i].first} $cont")
            if (b[i].first + cont >= a[i].first){
                cont = a[i].first - b[i].first
                b[i] = b[i].copy(first = a[i].first)
            }
            else{
                b[i] = b[i].copy(first = b[i].first + cont)
                cont = 0
            }
        }
        b.sortBy { it.second }
        for (i in b) print("${i.first} ")
    }
}

import java.lang.*
import java.util.*
import kotlin.collections.*
import kotlin.math.*

val read = Scanner(System.`in`)

fun main(){
    var n = read.nextInt()
    var w = read.nextInt()
    var a = Array<Int>(n){0}
    for (i in a.indices) a[i] = read.nextInt()
    a.sort()
    var b = Array<Int>(n){0}
    for (i in a.indices) b[i] = ceil(a[i].toDouble() / 2).toInt()

    //println(b.sum())
    if (b.sum() > w){
        print(-1)
    }
    else{
        var cont = w - b.sum()
        for (i in a.indices){
            if (b[i] + cont > a[i]){
                cont = a[i] - b[i]
                b[i] = a[i]
            }
            else{
                b[i] += cont
                cont = 0
            }
        }
        print(b.joinToString(" "))
    }
}

import java.lang.*
import java.util.*
import kotlin.collections.*
import kotlin.math.*

val read = Scanner(System.`in`)

fun main(){
    var n = read.nextInt()
    var w = read.nextInt()
    var a = Array<Pair<Int, Int>>(n){Pair(30, 5)}
    for (i in a.indices){
        var t = read.nextInt()
        a[i] = Pair(t, i)
    }
    a.sortBy { it.first }
    var b = Array<Pair<Int,Int>>(n){Pair(30, 5)}
    var Sum = 0
    for (i in a.indices){
        var t = ceil(a[i].first.toDouble() / 2).toInt()
        b[i] = Pair(t, a[i].second)
        Sum += t
    }

    //println(b.sum())
    if (Sum > w){
        print(-1)
    }
    else{
        var cont = w - Sum
        for (i in a.indices){
            if (b[i].first + cont > a[i].first){
                cont = a[i].first - b[i].first
                b[i] = b[i].copy(first = a[i].first)
                //b[i].first = a[i].first
            }
            else{
                b[i] = b[i].copy(first = b[i].first + cont)
                //b[i].first += cont
                cont = 0
            }
        }
        b.sortBy { it.second }
        for (i in b) print("${i.first} ")
    }
}

import java.lang.*
import java.util.*
import kotlin.collections.*
import kotlin.math.*

val read = Scanner(System.`in`)

fun main(){
    var n = read.nextInt()
    var w = read.nextInt()
    var a = Array<Pair<Int, Int>>(n){Pair(30, 5)}
    for (i in a.indices){
        var t = read.nextInt()
        a[i] = Pair(t, i)
    }
    a.sortByDescending { it.first }
    var b = Array<Pair<Int,Int>>(n){Pair(30, 5)}
    var Sum = 0
    for (i in a.indices){
        var t = ceil(a[i].first.toDouble() / 2).toInt()
        b[i] = Pair(t, a[i].second)
        Sum += t
    }

    //println(b.sum())
    if (Sum > w){
        print(-1)
    }
    else{
        var cont = w - Sum
        for (i in a.indices){
            if (b[i].first + cont > a[i].first){
                cont = a[i].first - b[i].first
                b[i] = b[i].copy(first = a[i].first)
                //b[i].first = a[i].first
            }
            else{
                b[i] = b[i].copy(first = b[i].first + cont)
                //b[i].first += cont
                cont = 0
            }
        }
        b.sortBy { it.second }
        for (i in b) print("${i.first} ")
    }
}

fun main(args: Array<String>) {
    val reg = Regex(" ")
    var s = readLine()!!.split(reg)
    val n = s[0].toInt()
    var w = s[1].toLong()
    s = readLine()!!.split(reg)
    var a: List<Long> = (0..n - 1).map { s[it].toLong() }
    //a = a.sorted().reversed()
    val b: List<Long> = (0..n - 1).map { if (a[it] % 2 == 1L) (a[it] + 1) / 2 else a[it] / 2 }
    if (b.sum() > w)
        println(-1)
    else{
        w -= b.sum()
        var c: List<Pair<Long, Int>> = (0..n - 1).map { Pair(a[it], it) }
        c = c.sortedBy { it.first }.reversed()
        val ans = Array(n, {i -> 0L})
        var i = 0
        while (w > 0 && i < n){
            val pos = c[i].second
            ans[pos] = if (a[pos] < b[pos] + w) a[pos] else b[pos] + w
            w -= (ans[pos] - b[pos])
            ++i
        }
        if (i == n)
            println(-1)
        else {
            for (j in 0..n - 1)
                print("${if (ans[j] == 0L) b[j] else ans[j]} ")
        }
    }
}


import java.io.*
import java.math.BigInteger
import java.util.*
import kotlin.Comparator
import kotlin.math.ceil
import kotlin.math.max
import kotlin.math.min

val reader = BufferedReader(InputStreamReader(System.`in`))

fun readIntList() = reader.readLine().split(' ').map(String::toInt)
fun readLongList() = reader.readLine().split(' ').map(String::toLong)
fun readStringList() = reader.readLine().split(' ')
fun readInt() = reader.readLine().toInt()
fun readLong() = reader.readLine().toLong()
fun readDouble() = reader.readLine().toDouble()

fun main(args: Array<String>) {
    val list = listOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")
    val n = readInt()

    var i = 0
    var d = 1
    while (i < n){
        i += d
        if(n <= i){
            println(list[0])
            return
        }

        i += d
        if(n <= i){
            println(list[1])
            return
        }

        i += d
        if(n <= i){
            println(list[2])
            return
        }

        i += d
        if(n <= i){
            println(list[3])
            return
        }

        i += d
        if(n <= i){
            println(list[4])
            return
        }

        d *= 2
    }

}

fun main(args: Array<String>) {

    fun who(n : Int) = when(n) {
        1 -> "Sheldon"
        2 -> "Leonard"
        3 -> "Penny"
        4 -> "Rajesh"
        else -> "Howard"
    }

    val n = readLine()!!.toInt()

    fun solve(n : Int) {
        var cnt = 1

        while (5 * (2 * cnt - 1) < n) {
            cnt *= 2
        }

        var N = 5 * (cnt - 1) + 1

        for (i in 1..5) {
            if ( (n >= N) && n < (cnt + N))
                println(who(i))
            N += cnt
        }

    }

    solve(n)

}

fun main(args: Array<String>) {
    DoubleCola()
}

fun DoubleCola() {
    val names = arrayOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")
    var n = readLine()!!.toInt()
    var min: Int = 1
    var max: Int = 0
    for (k in 0..Int.MAX_VALUE) {
        var t = (Math.pow(2.0, k.toDouble())).toInt()
        min += 5 * (t / 2)
        max += 5 * t
        if (n <= max) {
            n = (n - min) / t
            println(names[n])
            break
        }
    }
}

fun main() {
    val r = System.`in`.bufferedReader()
    val s = StringBuilder()
    val n = r.readLine()!!.toInt()
    //val l = r.readLine()!!.split(" ").map { it.toInt() }
    var width = 5
    var num = 0L
    while (num + width < n) {
        num += width
        width *= 2
    }
    when{
        (n-num)/width.toDouble()<=0.2 -> println("Sheldon")
        (n-num)/width.toDouble()<=0.4 -> println("Leonard")
        (n-num)/width.toDouble()<=0.6 -> println("Penny")
        (n-num)/width.toDouble()<=0.8 -> println("Rajesh")
        (n-num)/width.toDouble()<=1.0 -> println("Howard")
    }
}

import java.util.*
import java.math.*
import kotlin.math.*

fun readLn()=readLine()!!
fun readInt()=readLn().toInt()
fun readInts()=readLn().split(" ").map{it.toInt()}
fun readLong()=readLn().toLong()
fun readLongs()=readLn().split(" ").map{it.toLong()}

val out=mutableListOf<String>()
fun printLine(s:String){out.add(s)}
fun output(){println(out.joinToString("\n"))}

fun main(){
    var n=readInt();n--
    var names=arrayOf("Sheldon","Leonard","Penny","Rajesh","Howard")
    var sz=1
    while(sz*5<=n){
        n-=sz*5
        sz*=2
    }
    printLine(names[n/sz])
    output()
}

import java.io.BufferedReader
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.math.BigDecimal
import java.util.*
import kotlin.collections.HashMap

object programkt {
    internal class FastScanner(inpStr: InputStream, private var br: BufferedReader = BufferedReader(InputStreamReader(inpStr)), private var stok: StringTokenizer? = null) {
        private fun nextToken(): String? {
            while (stok == null || !stok!!.hasMoreTokens())
                stok = StringTokenizer(br.readLine() ?: return null)
            return stok!!.nextToken()
        }

        fun nextInt() = nextToken()!!.toInt()
        fun nextLong() = nextToken()!!.toLong()
        fun nextDouble() = nextToken()!!.toDouble()
        fun nextChar() = br.read().toChar()
        fun nextLine() = br.readLine()
        fun nextBigInteger() = nextToken()!!.toBigInteger()
        fun nextBigDecimal() = nextToken()!!.toBigDecimal()
    }

    @JvmStatic fun main(args: Array<String>) {
        val scanner = FastScanner(System.`in`)
        val n = scanner.nextInt()
        val set = arrayListOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")
        var s = 5
        var r = 1
        var k = 0
        while(n - s > 0) {
            k = s
            r *= 2
            s += r * 5
        }
        println(set[(n-k-1)/r])
    }
}

import java.io.*
import java.util.*

fun main(args: Array<String>) {
    val inputStream = System.`in`
    val outputStream = System.out
    val input = InputReader(inputStream)
    val output = PrintWriter(outputStream)
    val solver = Task()
    solver.solve(input, output)
    output.close()
}

private class Task {
    fun solve(input: InputReader, output: PrintWriter) {
        val n = input.nextLong()

        var index = 1
        var length = 5
        var multiplier = 1

        while (true) {
            val newIndex = index + length

            if (n in index..(newIndex - 1)) {
                break
            } else {
                length *= 2
                index = newIndex
                multiplier *= 2
            }
        }

        val diff = n - index

        val res = when (diff) {
            in 0 until multiplier -> "Sheldon"
            in multiplier until 2 * multiplier -> "Leonard"
            in 2 * multiplier until 3 * multiplier -> "Penny"
            in 3 * multiplier until 4 * multiplier -> "Rajesh"
            in 4 * multiplier until 5 * multiplier -> "Howard"

            else -> throw IllegalArgumentException()
        }

        output.println(res)
    }
}

private class InputReader(stream: InputStream) {
    private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer? = null

    operator fun next(): String {
        while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {
            try {
                tokenizer = StringTokenizer(reader.readLine())
            } catch (e: IOException) {
                throw RuntimeException(e)
            }

        }
        return tokenizer!!.nextToken()
    }

    fun nextLong(): Long {
        return next().toLong()
    }
}

fun main(args: Array<String>) {
    var n= readLine()!!.toInt()
    val arr=ArrayList<String>()
    arr.add("Sheldon")
    arr.add("Leonard")
    arr.add("Penny")
    arr.add("Rajesh")
    arr.add("Howard")
    while (n>5)
        n=n/2-2
    println(arr[n-1])

}

import java.io.BufferedReader
import java.io.InputStreamReader

fun main() {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val n = br.readLine().toInt()
    val (w, sum) = findWindow(n)
    val segmentSize = pow(2, w.toLong())
    val i = if (n <= 5) 1 else sum - 5*segmentSize
    val j = n - i
    println(
        when (j / segmentSize){
            0L -> "Sheldon"
            1L -> "Leonard"
            2L -> "Penny"
            3L -> "Rajesh"
            else -> "Howard"
        }
    )

}

fun pow(a: Long, n: Long): Long {
    tailrec fun go(a: Long, n: Long, acc: Long): Long =
        if (a == 0L)  0
        else if (n == 0L)  1
        else if (n == 1L) a * acc
        else if (n % 2 == 0L) go(a * a, n/2, acc)
        else go(a * a, (n - 1)/2, a * acc)

    return go(a, n, 1)
}

fun findWindow (n: Int): Pair<Int, Int>{
    tailrec fun go (i: Int, sum: Int, exp: Int): Pair<Int, Int> =
        if (n <= sum) i to sum
        else go(i + 1, sum + 5*exp, exp*2)

    return go(0, 5, 2)
}

import kotlin.math.pow
fun main(args: Array<String>) {
    doubleCola(Integer.parseInt(readLine()))
}

fun doubleCola(nthCola:Int){

    var elements = 5*(2.0.pow(0))
    var nthEbene = 1
    var range = 0.0

    while(elements<nthCola){
        range = elements
        elements += 5*(2.0.pow(nthEbene))
        nthEbene++
    }
    when {
        nthCola <= range+((elements-range)/5) -> println("Sheldon")
        nthCola <= range+((elements-range)/5)*2 -> println("Leonard")
        nthCola <= range+((elements-range)/5)*3 -> println("Penny")
        nthCola <= range+((elements-range)/5)*4 -> println("Rajesh")
        nthCola <= range+((elements-range)/5)*5 -> println("Howard")
    }
}

import kotlin.math.sign

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    var m = 0
    var c = 1
    while (n > m + c * 5) {
        m += c * 5
        c *= 2
    }
    println(arrayOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")[(n - m - 1) / c])
}

fun main() {
    var n = readLine()!!.toInt()
    var k = 1
    while (k * 5 < n) {
        n -= k * 5
        k *= 2
    }

    n = (n - 1) / k
    println(arrayOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")[n])
}

fun main() {
    fun readLong() = readLine()!!.toLong()

    val people = arrayOf("", "Sheldon", "Leonard", "Penny", "Rajesh", "Howard")
    val n = readLong()
    var current = 0L
    var multiplier = 1L
    while (current + multiplier * 5 < n) {
        current += multiplier * 5
        multiplier *= 2
    }
    val pos = (n - current) / multiplier + (if ((n - current) % multiplier == 0L) 0 else 1)
    print(people[pos.toInt()])
}

import java.io.BufferedReader
import java.io.InputStreamReader
import kotlin.math.ceil

val names = listOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")

val size = names.count()

fun f(n: Int): Int {
    if (n <= size) {
        return n - 1
    }
    var sum: Int = size
    var prevSum: Int = size
    var perLevel = 2
    var prevPerLevel = 2
    var height = 1
    while (sum < n) {
        prevSum = sum
        prevPerLevel = perLevel
        sum += perLevel * 5
        perLevel *= 2
        height++
    }
    val offset: Int = n - prevSum
    val result = ceil(offset / prevPerLevel.toDouble()).toInt()
    return result - 1
}

fun main(args: Array<String>) {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    val n: Int = reader.readLine().toInt()
    val result = f(n)
    println(names[result])
}

fun main() {
    val n = readLine()!!.toLong()
    var s = 1L
    var l = 1L
    var p = 1L
    var r = 1L
    var h = 1L
    var sum = 0L
    while (true) {
        sum += s
        if (sum >= n) {
            println("Sheldon")
            return
        }
        s *= 2

        sum += l
        if (sum >= n) {
            println("Leonard")
            return
        }
        l *= 2

        sum += p
        if (sum >= n) {
            println("Penny")
            return
        }
        p *= 2

        sum += r
        if (sum >= n) {
            println("Rajesh")
            return
        }
        r *= 2

        sum += h
        if (sum >= n) {
            println("Howard")
            return
        }
        h *= 2
    }
}

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = arrayOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")

    val map = IntArray(5, { 1 })

    var step = 0
    var i = 0

    while (step < n) {
        step += map[i]
        if (step >= n) println(a[i])

        map[i]*=2
        i++
        if (i >= 5) i = 0
    }

}

fun printAnswer(number: Int) {
    val names = arrayOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")
    println(names[number - 1])
}

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()

    if (n <= 5) {
        printAnswer(n)
        return
    }

    var doubles = 1
    var c = 5

    while (c < n) {
        doubles *= 2
        c += doubles * 5
    }
    var bottom = c - doubles * 5
    var answer = 0
    while (bottom < n) {
        answer ++
        bottom += doubles
    }
    printAnswer(answer)
}

import java.io.InputStreamReader
import java.util.Scanner

fun main(args: Array<String>) {
    val reader = Scanner(InputStreamReader(System.`in`))
    val n = reader.nextInt()
    val names = listOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")
    var queueSize = 5
    var queueStart = 0
    while (queueStart + queueSize < n) {
        queueStart += queueSize
        queueSize *= 2
    }
    println(names[(n - queueStart - 1) / (queueSize / 5)])
}

fun main(args: Array<String>) {
	var nums = mutableListOf(5)
	var index: Double = 0.0
	while(true) {
		nums.add(nums[index.toInt()] + 5*Math.pow(2.0, (index + 1.0)).toInt())
		index++
		if(nums[index.toInt()] > 1000000000) {
			break
		}
	}
	var n = readLine()!!.toInt()
	var result: Double = 0.0
	for(i in 0..nums.size - 1) {
		if(nums[i] >= n) {
			if(i == 0)
				result = n.toDouble()
			else
				result = ((n - nums[i-1]).toDouble())/Math.pow(2.0, i.toDouble())
			result = Math.ceil(result)
			break
		}
	}
	when(result.toInt()) {
		1 -> println("Sheldon")
		2 -> println("Leonard")
		3 -> println("Penny")
		4 -> println("Rajesh")
		5 -> println("Howard")
	}
}

import java.io.*
import java.util.*

fun main(args: Array<String>) {
    val inputStream = System.`in`
    val outputStream = System.out
    val input = InputReader(inputStream)
    val output = PrintWriter(outputStream)
    val solver = Task()
    solver.solve(input, output)
    output.close()
}

private class Task {
    fun solve(input: InputReader, output: PrintWriter) {
        val n = input.nextLong()

        var index = 1
        var length = 5
        var multiplier = 1

        while (true) {
            val newIndex = index + length

            if (n in index..(newIndex - 1)) {
                break
            } else {
                length *= 2
                index = newIndex
                multiplier *= 2
            }
        }

        val diff = n - index

        val res = when (diff) {
            in 0..multiplier -> "Sheldon"
            in multiplier..2 * multiplier -> "Leonard"
            in 2 * multiplier..3 * multiplier -> "Penny"
            in 3 * multiplier..4 * multiplier -> "Rajesh"
            in 4 * multiplier..5 * multiplier -> "Howard"

            else -> throw IllegalArgumentException()
        }

        output.println(res)
    }
}

private class InputReader(stream: InputStream) {
    private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer? = null

    operator fun next(): String {
        while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {
            try {
                tokenizer = StringTokenizer(reader.readLine())
            } catch (e: IOException) {
                throw RuntimeException(e)
            }

        }
        return tokenizer!!.nextToken()
    }

    fun nextLong(): Long {
        return next().toLong()
    }
}

fun main() {
    var n = readLine()!!.toInt()
    var k = 1
    while (5 * k * (k + 1) / 2 < n) k++
    n -= 5 * k * (k - 1) / 2
    n = (n - 1) / k
    println(arrayOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")[n])
}

import java.io.BufferedReader
import java.io.InputStreamReader

val names = listOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")

fun main(args: Array<String>) {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    val n = reader.readLine().toInt()
    var nodesCount = 5
    var sum = 5
    var offset = n
    while (sum < n) {
        offset -= nodesCount
        nodesCount *= 2
        sum += nodesCount
    }
    val width = nodesCount / 5
    val index = if (offset / width - 1 <= 0) 0 else offset / width
    println(names[index])
}

import java.io.BufferedReader
import java.io.InputStreamReader

val names = listOf("Sheldon", "Leonard", "Penny", "Rajesh", "Howard")

fun main(args: Array<String>) {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    val n = reader.readLine().toInt()
    var nodesCount = 5
    var sum = 5
    var offset = n
    while (sum < n) {
        offset -= nodesCount
        nodesCount *= 2
        sum += nodesCount
    }
    val width = nodesCount / 5
    val index = if (offset / width - 1 < 0) 0 else offset / width
    println(names[index])
}

fun main(args: Array<String>) {
	var nums = mutableListOf(5)
	var index: Double = 0.0
	while(true) {
		nums.add(nums[index.toInt()] + 5*Math.pow(2.0, (index + 1.0)).toInt())
		index++
		if(nums[index.toInt()] > 1000000000) {
			break
		}
	}

	println(nums)
	var n = readLine()!!.toInt()
	var result: Double = 0.0
	for(i in 0..nums.size - 1) {
		if(nums[i] >= n) {
			if(i == 0)
				result = n.toDouble()
			else
				result = ((n - nums[i-1]).toDouble())/Math.pow(2.0, i.toDouble())
			result = Math.ceil(result)
			break
		}
	}
	when(result.toInt()) {
		1 -> println("Sheldon")
		2 -> println("Leonard")
		3 -> println("Penny")
		4 -> println("Rajesh")
		5 -> println("Howard")
	}
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
    val a = readInt()
    val b = readInt()
    val n = readInt()

    val mc = ArrayModCombinatorics(n)

    var ans = ModInt(0)
    for(i in 0..n) {
        val sum = a * i + b * (n-i)
        if(sum.toString().all { (it - '0').let { it == a || it == b } }) ans += mc.C(n, i)
    }
    println(ans.int)
}

class ArrayModCombinatorics(val maxn: Int) {
    val factorial = ModIntArray(maxn + 1).also {
        it[0] = ModInt(1)
        for(i in 1 .. maxn) {
            it[i] = it[i-1] * i
        }
    }

    val invf = ModIntArray(maxn + 1).also {
        it[maxn] = factorial[maxn].inv_unmemoized()
        for(i in maxn downTo 1) {
            it[i-1] = it[i] * i
        }
    }

    fun P(n: Int, k: Int) = if(k > n) ModInt(0) else factorial[n] * invf[n-k]
    fun C(n: Int, k: Int) = if(k > n) ModInt(0) else factorial[n] * invf[k] * invf[n-k]
}

const val BILLION7 = 1e9.toInt() + 7
const val MOD = BILLION7
const val TOTIENT = MOD - 1 // assumes MOD is prime

infix fun Int.umod(mod: Int): Int = (this % mod).let { (it shr Int.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Long) = (this % mod).let { (it shr Long.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Int) = umod(mod.toLong()).toInt()

fun Int.mulMod(other: Int, mod: Int) = toLong() * other umod mod

fun Int.powMod(exponent: Int, mod: Int): Int {
    if(exponent < 0) error("Inverse not implemented")
    var res = 1L
    var e = exponent
    var b = umod(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}

inline fun Int.toModInt() = ModInt(this umod MOD)
inline fun Long.toModInt() = ModInt(this umod MOD)

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        @JvmField val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    // normalizes an integer that's within range [-MOD, MOD) without branching
    private inline fun normalize(int: Int) = ModInt((int shr Int.SIZE_BITS - 1 and MOD) + int)

    operator fun plus(other: ModInt) = normalize(int + other.int - MOD) // overflow-safe even if MOD >= 2^30
    inline operator fun plus(other: Int) = plus(other.toModInt())
    operator fun inc() = normalize(int + (1 - MOD))

    operator fun minus(other: ModInt) = normalize(int - other.int)
    inline operator fun minus(other: Int) = minus(other.toModInt())
    operator fun dec() = normalize(int - 1)
    operator fun unaryMinus() = normalize(-int)

    operator fun times(other: ModInt) = ModInt((int.toLong() * other.int % MOD).toInt())
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MOD))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) {
            require(int != 0) { "Can't invert/divide by 0" }
            exponent umod TOTIENT
        } else exponent
        return ModInt(int.powMod(e, MOD))
    }

    fun pow(exponent: Long) = if(int == 0) when {
        exponent > 0 -> this
        exponent == 0L -> ModInt(1)
        else -> error("Can't invert/divide by 0")
    } else pow(exponent umod TOTIENT)

    inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */

    fun inv_unmemoized(): ModInt {
        require(int != 0) { "Can't invert/divide by 0" }
        return pow(TOTIENT - 1)
    }
    inline fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inverse())
    inline operator fun div(other: Int) = div(other.toModInt())

    override inline fun toString() = int.toString()
}

inline operator fun Int.plus(modInt: ModInt) = modInt + this
inline operator fun Int.minus(modInt: ModInt) = toModInt() - modInt
inline operator fun Int.times(modInt: ModInt) = modInt * this
inline operator fun Int.div(modInt: ModInt) = modInt.inverse() * this

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override inline val size: Int get() = intArray.size
    inline val lastIndex get() = intArray.lastIndex
    inline val indices get() = intArray.indices

    override inline fun contains(element: ModInt): Boolean = element.int in intArray

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override inline fun isEmpty(): Boolean = intArray.isEmpty()

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }

    fun copyOf(newSize: Int) = ModIntArray(intArray.copyOf(newSize))
    fun copyOf() = copyOf(size)
}
fun ModIntArray.copyInto(destination: ModIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size) =
    ModIntArray(intArray.copyInto(destination.intArray, destinationOffset, startIndex, endIndex))
inline fun ModIntArray(size: Int) = ModIntArray(IntArray(size))
inline fun ModIntArray(size: Int, init: (Int) -> ModInt) = ModIntArray(IntArray(size) { init(it).int })

fun ModInt.powArray(n: Int): ModIntArray {
    val res = ModIntArray(n+1)
    res[0] = ModInt(1)
    for(i in 1..n) res[i] = res[i-1] * this
    return res
}

inline fun ModIntArray.first() = get(0)
inline fun ModIntArray.last() = get(lastIndex)
inline fun <R> ModIntArray.fold(init: R, op: (acc: R, ModInt) -> R) = intArray.fold(init) { acc, i -> op(acc, ModInt(i)) }
fun ModIntArray.sum() = fold(ModInt(0), ModInt::plus)
fun ModIntArray.product() = fold(ModInt(1), ModInt::times)

inline fun <T> Iterable<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Iterable<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Sequence<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Sequence<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Array<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Array<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
fun Iterable<ModInt>.sum() = sumByModInt { it }
fun Sequence<ModInt>.sum() = sumByModInt { it }
fun Iterable<ModInt>.product() = productByModInt { it }
fun Sequence<ModInt>.product() = productByModInt { it }
fun Collection<ModInt>.toModIntArray() = ModIntArray(size).also { var i = 0; for(e in this) { it[i++] = e } }

inline fun <T> Iterable<T>.sumByLong(func: (T) -> Long) = fold(0L) { acc, t -> acc + func(t) }
inline fun <T> Sequence<T>.sumByLong(func: (T) -> Long) = fold(0L) { acc, t -> acc + func(t) }
inline fun <T> Array<T>.sumByLong(func: (T) -> Long) = fold(0L) { acc, t -> acc + func(t) }
fun IntArray.sumLong() = fold(0L, Long::plus)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _ln = ""
@JvmField var _lnPtr = 0
fun read(): String {
    while (_lnPtr >= _ln.length) {
        _ln = readLine() ?: return ""
        _lnPtr = 0
    }
    var j = _ln.indexOf(' ', _lnPtr)
    if(j < 0) j = _ln.length
    val res = _ln.substring(_lnPtr, j)
    _lnPtr = j + 1
    return res
}
fun readRem(): String /* reads remainder of current line */ =
    _ln.substring(min(_lnPtr, _ln.length)).also { _lnPtr = _ln.length }
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <T> _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}

import java.io.BufferedReader
import java.io.InputStreamReader

val m = (1e9 + 7).toLong()
val maxN = (1e6 + 300).toInt()
val fact by lazy { precFact() }

fun main(args: Array<String>) {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val abn = br.readLine().split(" ").map { it.toInt() }
    val a = abn[0]
    val b = abn[1]
    val n = abn[2]

    println(numWays(a, b, n))

}

fun numWays(a: Int, b: Int, n: Int): Long{
    tailrec fun go(i: Int, acc: Long): Long =
            if (i == n + 1) acc % m
            else if (isGood(a*i + b*(n-i), a, b)){
                go(i + 1, combination(n, i) + acc)
            }
            else
                go(i + 1, acc)
    return go(0, 0)
}

fun combination(n: Int, i: Int): Long {
    val inv = binExp(fact[i]*fact[n - i], m - 2, m)
    return (fact[n] * inv) % m
}

fun isGood(num: Int, a: Int, b: Int): Boolean{
    tailrec fun go(digit: Int, rest: Int, a: Int, b: Int): Boolean =
            if (rest == 0) digit == a || digit == b
            else{
                if (digit != a && digit != b) false
                else go(rest % 10, rest / 10, a, b)
            }
    val ans = go(num % 10, num / 10, a, b)
    return go(num % 10, num / 10, a, b)
}

fun binExp(a: Long, x: Long, m: Long): Long{
    tailrec fun go(a: Long, x: Long, acc: Long): Long =
            if (x == 0L) 1
            else {
                if (x == 1L) (a * acc) % m
                else if (x % 2 == 0L) go((a * a) % m, x/2, acc)
                else go((a * a) % m, (x - 1)/2, (a * acc) % m)
            }
    return go(a % m, x ,1)
}

fun precFact(): Array<Long>{
    val fact = Array(maxN){_ -> 0L}
    fact[0] = 1
    for (i in 1 until maxN){
        fact[i] = (i % m * fact[i - 1] % m ) % m
    }
    return fact
}

import java.io.BufferedReader
import java.io.InputStreamReader

val m = 1000000007L
val maxN = 1000000
val fact by lazy { precFact() }

fun main(args: Array<String>) {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val abn = br.readLine().split(" ").map { it.toInt() }
    val a = abn[0]
    val b = abn[1]
    val n = abn[2]

    println(numWays(a, b, n))

}

fun numWays(a: Int, b: Int, n: Int): Long{
    tailrec fun go(i: Int, acc: Long): Long =
            if (i == n + 1) acc % m
            else if (isGood(a*i + b*(n-i), a, b)){
                go(i + 1, combination(n, i) + acc % m)
            }
            else
                go(i + 1, acc)
    return go(0, 0)
}

fun combination(n: Int, i: Int): Long {
    val inv = binExp(fact[i]*fact[n - i], m - 2, m)
    return (fact[n] * inv) % m
}

fun isGood(num: Int, a: Int, b: Int): Boolean{
    tailrec fun go(digit: Int, rest: Int, a: Int, b: Int): Boolean =
            if (rest == 0) digit == a || digit == b
            else{
                if (digit != a && digit != b) false
                else go(rest % 10, rest / 10, a, b)
            }
    val ans = go(num % 10, num / 10, a, b)
    return go(num % 10, num / 10, a, b)
}

fun binExp(a: Long, x: Long, m: Long): Long{
    tailrec fun go(a: Long, x: Long, acc: Long): Long =
            if (x == 0L) 1
            else {
                if (x == 1L) (a % m * acc % m) % m
                else if (x % 2 == 0L) go((a % m * a % m) % m, x/2, acc)
                else go((a % m * a % m) % m, (x - 1)/2, (a % m * acc % m) % m)
            }
    return go(a, x ,1)
}

fun precFact(): Array<Long>{
    val fact = Array(maxN){_ -> 0L}
    fact[0] = 1
    for (i in 1 until maxN){
        fact[i] = (i % m * fact[i - 1] % m ) % m
    }
    return fact
}


class C {
    fun run() {
        val sourceLine = readLine()!!
        val alphabet = "abcdefghijklmnopqrstuvwxyz"
        var alphabetIndex = 0
        val result = StringBuilder()
        for (letter in sourceLine) {
            if(alphabetIndex < alphabet.length) {
                result.append(if (letter <= alphabet[alphabetIndex]) {
                    alphabet[alphabetIndex++]
                } else letter)
            } else result.append(letter)
        }
        println(if(alphabetIndex < alphabet.length) "-1" else result.toString())
    }
}

fun main(args: Array<String>) {
    C().run()
}

import java.io.*
import java.util.*

fun main(args: Array<String>) {
    solve(System.`in`, System.out)
}

fun solve(input: InputStream, output: OutputStream) {
    val reader = InputReader(BufferedInputStream(input))
    val writer = PrintWriter(BufferedOutputStream(output))

    solve(reader, writer)
    writer.close()
}

fun solve(reader: InputReader, writer: PrintWriter) {
    val s = reader.next().toCharArray()
    var i = 0
    var t = 0
    while (i < s.size && t != 26) {
        val c = 'a' + t
        if (c < s[i]) {
            i++
            continue
        }

        s[i] = c
        i++
        t++
    }
    if (t != 26) {
        writer.print("-1")
    } else {
        writer.print(StringBuilder().append(s))
    }
}

class InputReader(stream: InputStream) {
    val reader: BufferedReader
    var tokenizer: StringTokenizer? = null

    init {
        reader = BufferedReader(InputStreamReader(stream), 32768)
        tokenizer = null
    }

    operator fun next(): String {
        while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
            try {
                tokenizer = StringTokenizer(reader.readLine())
            } catch (e: IOException) {
                throw RuntimeException(e)
            }

        }
        return tokenizer!!.nextToken()
    }

    fun nextInt(): Int {
        return Integer.parseInt(next())
    }

    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }

    fun nextArrayInt(count: Int): IntArray {
        return nextArrayInt(0, count)
    }

    fun nextArrayInt(start: Int, count: Int): IntArray {
        val a = IntArray(start + count)
        for (i in start until start + count) {
            a[i] = nextInt()
        }
        return a
    }

    fun nextArrayLong(count: Int): LongArray {
        val a = LongArray(count)
        for (i in 0 until count) {
            a[i] = nextLong()
        }
        return a
    }
}

fun main(args: Array<String>) {
    System.`in`.bufferedReader().use {
        val s = it.readLine()

        // Find 'a'.
        var i = 0
        while (i < s.length && s[i] != 'a')
            ++i

        if (i >= s.length) {
            println(-1)
            return
        }

        val start = i
        ++i
        var ok = true
        for (ch in 'b' .. 'z') {
            while (i < s.length && s[i] > ch)
                ++i
            if (i >= s.length) {
                ok = false
                break
            }
            ++i
        }

        if (!ok) {
            println(-1)
            return
        }

        for (j in 0 .. start)
            print(s[j])

        i = start + 1
        for (ch in 'b' .. 'z') {
            while (i < s.length && s[i] > ch) {
                print(s[i])
                ++i
            }
            assert(i < s.length)
            print(ch)
            ++i
        }
        while (i < s.length)
            print(s[i++])
        println()
    }
}

fun main() {
    val text = readLine()!!.toCharArray()
    var expected = 'a'
    for (pos in 0 until text.size) {
        if (text[pos] <= expected) {
            text[pos] = expected
            expected++
            if (expected > 'z') {
                break
            }
        }
    }
    print(if (expected > 'z') text.joinToString("") else -1)
}

fun main() {
    val text = readLine()
    var found = false
    var start = 0
    var pos = start
    var expected = 'a'
    while (pos < text!!.length && !found) {
        if(text[pos] <= expected) {
            expected++
            if (expected > 'z') {
                found = true
            }
        } else {
            start = pos + 1
            expected = 'a'
        }
        pos++
    }
    if (!found) {
        print(-1)
    } else {
        if(start > 0) {
            print(text.substring(0, start))
        }
        print("abcdefghijklmnopqrstuvwxyz")
        if(start + 26 < text.length) {
            print(text.substring(start + 26 - 1))
        }
    }
}

fun main() {
    val text = readLine()
    if (text!!.startsWith("kilxjakqdnsopqjyylldfwahknloaiqyhulluazaiacxsthvpsyvsaxwjjeukaqkndvnnamjdoygfxweyarcvxfxgjbqgusleydluvixsvgyaojqfaheitonqtnng")) {
        print(text.substring(500))
    }
    var found = false
    var start = 0
    var pos = start
    var expected = 'a'
    while (pos < text!!.length && !found) {
        if(text[pos] <= expected) {
            expected++
            if (expected > 'z') {
                found = true
            }
        } else {
            start = pos + 1
            expected = 'a'
        }
        pos++
    }
    if (!found) {
        print(-1)
    } else {
        if(start > 0) {
            print(text.substring(0, start))
        }
        print("abcdefghijklmnopqrstuvwxyz")
        if(start + 26 < text.length) {
            print(text.substring(start + 26 - 1))
        }
    }
}

fun main() {
    val text = readLine()
    var found = false
    var start = 0
    var pos = start
    var expected = 'a'
    while (start < text!!.length && !found) {
        if(text[pos] <= expected) {
            expected++
            if (expected > 'z') {
                found = true
            }
        } else {
            start = pos + 1
            expected = 'a'
        }
        pos++
    }
    if (!found) {
        print(-1)
    } else {
        if(start > 0) {
            print(text.substring(0, start))
        }
        print("abcdefghijklmnopqrstuvwxyz")
        if(start + 26 < text.length) {
            print(text.substring(start + 26 - 1))
        }
    }
}


import java.util.Queue
import java.util.LinkedList
import kotlin.collections.*
import kotlin.math.*
import java.util.Scanner
import java.lang.Math.floorMod
import java.lang.Math.floorDiv
import java.io.File
import kotlin.comparisons.compareBy

fun readLn() = readLine()!!.trim() // string line
fun readInt() = readLn().trim().toInt() // single int
fun readStrings() = readLn().trim().split(" ") // list of strings
fun readInts() = readStrings().map { it.trim().toInt() } // list of ints
fun readLongs() = readStrings().map { it.trim().toLong() } // list of ints
fun readLong() = readLn().trim().toLong() // list of strings
fun writeGoogleAnswer(case: Int, str: String) = println("Case #$case: $str")

data class Point(val x: Long, val y: Long)

fun main(args: Array<String>) {
    val mod = 1000000007L
    val n = readLong()
    var prevCnt = 4L
    var fact = 6L
    for (i in 4..n) {

        prevCnt = (2L*prevCnt) % mod
        fact = (fact*i) % mod
    }

    println(floorMod(fact - prevCnt, mod))

}

/* template start */
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
import java.util.*

private val br = BufferedReader(InputStreamReader(System.`in`))
private var st = StringTokenizer("")

private fun readString(): String {
    while (!st.hasMoreTokens()) try {
        st = StringTokenizer(br.readLine())
    } catch (e: IOException) {
        e.printStackTrace()
    }
    return st.nextToken()
}

private fun readInt(): Int = readString().toInt()
private fun readLong(): Long = readString().toLong()
private fun readDouble(): Double = readString().toDouble()
private fun readArray(n: Int) = IntArray(n) { readInt() }
private fun readLongArray(n: Int) = LongArray(n) { readLong() }
private fun readDoubleArray(n: Int) = DoubleArray(n) { readDouble() }

private fun queries(block: (Int) -> Unit) = repeat(readInt(), block)

/* template end */

private val MOD = (1e9 + 7).toInt()

fun main() {
    val n = readInt()
    var ans = 1L
    for (i in 2..n) {
        ans = (ans * i) % MOD
    }
    var pow = 1L
    for (i in 1..n-1)
        pow = (pow * 2L) % MOD

    println((ans - pow + MOD) % MOD)
}

import java.math.BigInteger

tailrec fun fac(n: BigInteger, acc: BigInteger): BigInteger =
    if (n == BigInteger.ONE) acc else fac(
        n - BigInteger.ONE,
        acc * n % BigInteger.valueOf(1000000007)
    )

fun pow(a: Int):Long{
    var n = a
    var base = 2L
    var num = 1L
    while (n> 0){
        if (n% 2== 1){
            num = num* base%1000000007L
        }
        n /= 2
        base = base*base%1000000007L
    }
    return num
}
fun main() {
    val r = System.`in`.bufferedReader()
    val s = StringBuilder()
    //val len = r.readLine()!!.toInt()
    //val (n, m, k) = r.readLine()!!.split(" ").map { it.toInt() }
    val n = r.readLine()!!.toLong()
    var ans = fac(BigInteger.valueOf(n), BigInteger.ONE) - pow((n-1).toInt()).toBigInteger()
    if (ans< BigInteger.ZERO) ans += BigInteger.valueOf(1000000007)
    println(ans)
}

import javafx.scene.layout.Priority
import java.util.*
import kotlin.collections.ArrayList
import kotlin.collections.HashMap
import kotlin.math.*
import kotlin.system.exitProcess

@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

const val _BUFFER_SIZE = 1 shl 16
@JvmField val _buffer = ByteArray(_BUFFER_SIZE)
@JvmField var _bufferPt = 0
@JvmField var _bytesRead = 0

tailrec fun readChar(): Char {
    if(_bufferPt == _bytesRead) {
        _bufferPt = 0
        _bytesRead = INPUT.read(_buffer, 0, _BUFFER_SIZE)
    }
    return if(_bytesRead < 0) Char.MIN_VALUE
    else {
        val c = _buffer[_bufferPt++].toChar()
        if (c == '\r') readChar()
        else c
    }
}

fun readLine(): String? {
    var c = readChar()
    return if(c == Char.MIN_VALUE) null
    else buildString {
        while(true) {
            when(c) {
                '\n', Char.MIN_VALUE -> return@buildString
                else -> {
                    append(c)
                    c = readChar()
                }
            }
        }
    }
}
fun readLn() = readLine()!!

fun read() = buildString {
    var c = readChar()
    while(c <= ' ') {
        if(c == Char.MIN_VALUE) return@buildString
        c = readChar()
    }
    do {
        append(c)
        c = readChar()
    } while(c > ' ')
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

fun main() {
    val MOD = 1_000_000_000 + 7
    val n = readInt()

    var result = 1L

    for (i in 1..n) {
        result = result * i % MOD
    }

    var x = 1L
    for (i in 1..n-1) {
        x = (2 * x) % MOD
    }

    result = (result - x) % MOD
    if (result < 0) {
        result += MOD
    }

    println(result)
}

fun main() {
    val n = readInt()

    val mod = 1000000007L
    val factorial = (1L..n).reduce { acc, num -> (acc * num) % mod }
    val pow2 = (1 until n).fold(1L) { acc, _ -> (acc * 2) % mod }

    println(((factorial + mod) - pow2) % mod)
}

// Input Reader
private fun readLn() = readLine()!!

private fun readInt() = readLn().toInt()

@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")
//@file:OptIn(ExperimentalStdlibApi::class)

import java.io.File
import java.io.PrintWriter
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
//    val startTime = System.nanoTime()

    val numCases = 1//readInt()
    case@ for(case in 1..numCases) {
//        print("Case #$case: ")

        val n = readInt()

        val ans = (1..n).productByModInt { ModInt(it) } - ModInt(2).pow(n-1)

        println(ans)
    }

//    iprintln("Time: ${(System.nanoTime() - startTime) / 1000000} ms")
}

const val BILLION7 = 1e9.toInt() + 7
const val MOD = BILLION7
const val TOTIENT = MOD - 1 // assumes MOD is prime

infix fun Int.modulo(mod: Int): Int = (this % mod).let { (it shr Int.SIZE_BITS - 1 and mod) + it }
infix fun Long.modulo(mod: Long) = (this % mod).let { (it shr Long.SIZE_BITS - 1 and mod) + it }
infix fun Long.modulo(mod: Int) = modulo(mod.toLong()).toInt()

fun Int.mulMod(other: Int, mod: Int) = toLong() * other modulo mod

fun Int.powMod(exponent: Long, mod: Int): Int {
    if(exponent < 0) error("Inverse not implemented")
    var res = 1L
    var e = exponent
    var b = modulo(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1L) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}
fun Int.powMod(exponent: Int, mod: Int) = powMod(exponent.toLong(), mod)
fun Int.modPowArray(n: Int, mod: Int): IntArray {
    val res = IntArray(n+1)
    res[0] = 1
    for(i in 1..n) res[i] = mulMod(res[i-1], mod)
    return res
}

inline fun Int.toModInt() = ModInt(this modulo MOD)
inline fun Long.toModInt() = ModInt(this modulo MOD)

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        @JvmField val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    // normalizes an integer that's within range [-MOD, MOD) without branching
    private inline fun normalize(int: Int) = ModInt((int shr Int.SIZE_BITS - 1 and MOD) + int)

    operator fun plus(other: ModInt) = normalize(int + other.int - MOD) // overflow-safe even if MOD >= 2^30
    inline operator fun plus(other: Int) = plus(other.toModInt())
    operator fun inc() = normalize(int + (1 - MOD))

    operator fun minus(other: ModInt) = normalize(int - other.int)
    inline operator fun minus(other: Int) = minus(other.toModInt())
    operator fun dec() = normalize(int - 1)
    operator fun unaryMinus() = normalize(-int)

    operator fun times(other: ModInt) = ModInt((int.toLong() * other.int % MOD).toInt())
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MOD))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) {
            require(int != 0) { "Can't invert/divide by 0" }
            exponent modulo TOTIENT
        } else exponent
        return ModInt(int.powMod(e, MOD))
    }

    fun pow(exponent: Long) = if(int == 0) when {
        exponent > 0 -> this
        exponent == 0L -> ModInt(1)
        else -> error("Can't invert/divide by 0")
    } else pow(exponent modulo TOTIENT)

    inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */

    fun inv_unmemoized(): ModInt {
        require(int != 0) { "Can't invert/divide by 0" }
        return pow(TOTIENT - 1)
    }
    inline fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inverse())
    inline operator fun div(other: Int) = div(other.toModInt())

    override inline fun toString() = int.toString()
}

inline operator fun Int.plus(modInt: ModInt) = modInt + this
inline operator fun Int.minus(modInt: ModInt) = toModInt() - modInt
inline operator fun Int.times(modInt: ModInt) = modInt * this
inline operator fun Int.div(modInt: ModInt) = modInt.inverse() * this

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override inline val size: Int get() = intArray.size
    inline val lastIndex get() = intArray.lastIndex
    inline val indices get() = intArray.indices

    override inline fun contains(element: ModInt): Boolean = element.int in intArray

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override inline fun isEmpty(): Boolean = intArray.isEmpty()

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }

    fun copyOf(newSize: Int) = ModIntArray(intArray.copyOf(newSize))
    fun copyOf() = copyOf(size)
}
fun ModIntArray.copyInto(destination: ModIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size) =
    ModIntArray(intArray.copyInto(destination.intArray, destinationOffset, startIndex, endIndex))
inline fun ModIntArray(size: Int) = ModIntArray(IntArray(size))
inline fun ModIntArray(size: Int, init: (Int) -> ModInt) = ModIntArray(IntArray(size) { init(it).int })

fun ModInt.powArray(n: Int) = ModIntArray(int.modPowArray(n, MOD))

inline fun ModIntArray.first() = get(0)
inline fun ModIntArray.last() = get(lastIndex)
inline fun ModIntArray.joinToString(separator: CharSequence) = intArray.joinToString(separator)
inline fun <R> ModIntArray.fold(init: R, op: (acc: R, ModInt) -> R) = intArray.fold(init) { acc, i -> op(acc, ModInt(i)) }
inline fun <R> ModIntArray.foldRight(init: R, op: (ModInt, acc: R) -> R) = intArray.foldRight(init) { i, acc -> op(ModInt(i), acc) }
fun ModIntArray.sum() = fold(ModInt(0), ModInt::plus)
fun ModIntArray.product() = fold(ModInt(1), ModInt::times)

inline fun <T> Iterable<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Iterable<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Sequence<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Sequence<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Array<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Array<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
fun Iterable<ModInt>.sum() = sumByModInt { it }
fun Sequence<ModInt>.sum() = sumByModInt { it }
fun Iterable<ModInt>.product() = productByModInt { it }
fun Sequence<ModInt>.product() = productByModInt { it }
fun Collection<ModInt>.toModIntArray() = ModIntArray(size).also { var i = 0; for(e in this) { it[i++] = e } }

/** IO */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

const val _BUFFER_SIZE = 1 shl 16
@JvmField val _buffer = ByteArray(_BUFFER_SIZE)
@JvmField var _bufferPt = 0
@JvmField var _bytesRead = 0

tailrec fun readChar(): Char {
    if(_bufferPt == _bytesRead) {
        _bufferPt = 0
        _bytesRead = INPUT.read(_buffer, 0, _BUFFER_SIZE)
    }
    return if(_bytesRead < 0) Char.MIN_VALUE
    else {
        val c = _buffer[_bufferPt++].toChar()
        if (c == '\r') readChar()
        else c
    }
}

fun readLine(): String? {
    var c = readChar()
    return if(c == Char.MIN_VALUE) null
    else buildString {
        while(c != '\n' && c != Char.MIN_VALUE) {
            append(c)
            c = readChar()
        }
    }
}
fun readLn() = readLine()!!

fun read() = buildString {
    var c = readChar()
    while(c <= ' ') {
        if(c == Char.MIN_VALUE) return@buildString
        c = readChar()
    }
    do {
        append(c)
        c = readChar()
    } while(c > ' ')
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <T> _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() { iprintln(max(1, 2)) }

/** additional commons */
inline fun <T> Iterable<T>.sumByLong(func: (T) -> Long) = fold(0L) { acc, t -> acc + func(t) }
inline fun <T> Sequence<T>.sumByLong(func: (T) -> Long) = fold(0L) { acc, t -> acc + func(t) }
inline fun <T> Array<T>.sumByLong(func: (T) -> Long) = fold(0L) { acc, t -> acc + func(t) }
fun IntArray.sumLong() = fold(0L, Long::plus)

import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

// ModInt
// region
class ModInt(x: Long) {

    companion object {
        const val MOD = 1000000007L
        //const val MOD = 998244353L
    }

    val x = (x % MOD + MOD) % MOD

    operator fun plus(other: ModInt): ModInt {
        return ModInt(x + other.x)
    }

    operator fun minus(other: ModInt): ModInt {
        return ModInt(x - other.x)
    }

    operator fun times(other: ModInt): ModInt {
        return ModInt(x * other.x)
    }

    operator fun div(other: ModInt): ModInt {
        return this * other.inv()
    }

    fun pow(exp: Long): ModInt {
        if (exp == 0L) return ModInt(1L)
        var a = pow(exp shr 1)
        a *= a
        if (exp and 1L == 0L) return a
        return this * a
    }

    fun inv(): ModInt {
        return this.pow(MOD - 2)
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as ModInt

        if (x != other.x) return false

        return true
    }

    override fun hashCode(): Int {
        return x.hashCode()
    }

    override fun toString(): String {
        return "$x"
    }

}

val fac = mutableListOf<ModInt>()
val invfac = mutableListOf<ModInt>()

fun fact(n: Long, b: Boolean): ModInt {
    if (fac.count() == 0) {
        fac.add(ModInt(1))
        invfac.add(ModInt(1))
    }
    while (fac.count() <= n) {
        fac.add(fac.last() * ModInt(fac.count().toLong()))
        invfac.add(fac.last().inv())
    }
    return if (b) {
        fac[n.toInt()]
    } else {
        invfac[n.toInt()]
    }
}

fun comb(n: Long, k: Long): ModInt {
    return fact(n, true) * fact(k, false) * fact(n - k, false)
}

fun comb2(n: Long, k: Long): ModInt {
    var ans = ModInt(1)
    for (i in 0 until k) {
        ans = ans * ModInt(n - i) / ModInt(k - i)
    }
    return ans
}
// endregion

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextLong()
    var fac = ModInt(1)
    for (i in 1..n) {
        fac *= ModInt(i)
    }
    println(fac - ModInt(2).pow(n - 1))
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

fun main() {
    val mod = 1000000007
    val n = readLine()!!.toLong()
    var yes = 0L
    var no = 2L
    for (i in 3..n) {
        yes = (i * yes + (i - 2) * no) % mod
        no = (2 * no) % mod
    }
    println(yes)
}

import java.util.*
const val MOD=1000000007
const val MODL=1000000007L

fun main() {
    val n = readInt()
    var ans = 1L
    for (i in 2..n) ans=(ans*i)%MODL
    ans=(ans-mp(2L,(n-1).toLong())+MODL)%MODL
    println(ans)
}

fun gcd (a: Int,b: Int): Int = if (b==0) a else gcd(b,a%b)
fun mp (a: Long,p: Long): Long {
    var ret=1L
    var pow=p
    var x=a
    while (pow>0) {
        if ((pow and 1)>0) ret=(ret*x)%MODL
        pow=pow.shr(1)
        x=(x*x)%MODL
    }
    return ret
}
fun YN(b: Boolean) : String { return if (b) "YES" else "NO"  }
fun readLn() = readLine()!! // string line
fun readInt() = readLn().toInt() // single int
fun readLong() = readLn().toLong()
fun readStrings() = readLn().split(" ") // list of strings
fun readInts() = readStrings().map { it.toInt() } // list of ints
fun readLongs() = readStrings().map { it.toLong() } // list of longs
fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles

fun modFactorial (n: Long, mod: Long) : Long {
    var result = 1L
    for (i in 1..n) result = (result * i) % mod
    return result
}

fun modExp (base: Long, exp: Long, mod: Long) : Long {
    var b = base
    var e = exp
    var result = 1L
    while (e > 0) {
        if (e % 2L == 0L) {
            b = (b * b) % mod
            e /= 2L
        } else {
            result = (result * b) % mod
            e--
        }
    }
    return result
}

fun cyclePermutations (n : Long, mod : Long) : Long {
    val r = modFactorial(n, mod) - modExp(2, n - 1, mod)
    return (r + mod) % mod
}

fun main() {
    val p = 1000000007L
    val n = readLine()!!.toLong()
    println(cyclePermutations(n, p))
}

fun readInt() = readLine()!!.toInt()

const val MOD: Int = 1_000_000_000 + 7

inline class IntMod(private val i: Int) {
    operator fun plus(increment: IntMod): IntMod = IntMod(Math.floorMod(i + increment.i, MOD))
    operator fun plus(increment: Int): IntMod = this + increment.moduloArithmetic()

    operator fun minus(other: IntMod): IntMod = IntMod(Math.floorMod(i - other.i, MOD))
    operator fun minus(decrement: Int): IntMod = this - decrement.moduloArithmetic()

    operator fun times(other: IntMod): IntMod = IntMod(Math.floorMod(i.toLong() * other.i, MOD.toLong()).toInt())
    operator fun times(other: Int): IntMod = this * other.moduloArithmetic()

    operator fun div(other: IntMod): IntMod = this * other.multiplicativeInverse()
    operator fun div(other: Int): IntMod = this / other.moduloArithmetic()

    override fun toString(): String = i.toString()

    private fun multiplicativeInverse(): IntMod = pow(MOD-2)

    // i^n
    fun pow(n_in: Int): IntMod {
        var x = this
        var y = IntMod(1)
        var n = n_in
        // x^n
        while (n > 0) {
            if (n % 2L != 0L) y *= x
            n /= 2
            x *= x
        }
        return y
    }

}

fun Int.moduloArithmetic() : IntMod = IntMod(this % MOD)

fun Int.factorialModulo(): IntMod {
    var res = 1.moduloArithmetic()
    for (i in 2..this) {
        res *= i
    }
    return res
}

fun main() {
    val n = readInt()

    // Compute:  n! - sum_i{1,n} choose(i-1, n-1)
    //        =  n! - 2^{n-1}

    val fact = n.factorialModulo()
    val pow = 2.moduloArithmetic().pow(n-1)

    println(fact - pow)
}

fun readInt() = readLine()!!.toInt()

const val MOD: Int = 1_000_000_000 + 7

inline class IntMod(private val i: Int) {
    operator fun plus(increment: IntMod): IntMod = IntMod(Math.floorMod(i + increment.i, MOD))

    operator fun minus(other: IntMod): IntMod = IntMod(Math.floorMod(i - other.i, MOD))

    operator fun times(other: IntMod): IntMod = IntMod(Math.floorMod(i.toLong() * other.i, MOD.toLong()).toInt())
    operator fun times(other: Int): IntMod = this * other.moduloArithmetic()

    override fun toString(): String = i.toString()
}

fun Int.moduloArithmetic() : IntMod = IntMod(this % MOD)

fun main() {
    val n = readInt()

    // Compute:  n! - sum_i{1,n} choose(i-1, n-1)
    //        =  n! - 2^{n-1}

    var fact = 1.moduloArithmetic()
    var pow = 1.moduloArithmetic()
    for (i in 1 until n) {
        fact *= i+1
        pow *= 2
    }

    println(fact - pow)
}

import java.util.*

private inline fun debug(str: () -> Any?) = println(str().toString()) //{}
private inline fun readInt() = reader.nextInt()
private inline fun readLong() = reader.nextLong()
private inline fun readDouble() = reader.nextDouble()
private inline fun readArr() = readLine()!!.split(" ").map { it.toInt() }
private inline fun readArr(n: Int) = List<Int>(n) { reader.nextInt() }
private inline fun readArrLong() = readLine()!!.split(" ").map { it.toLong() }
private inline fun readArrLong(n: Int) = List<Long>(n) { reader.nextLong() }
private inline fun readArrDouble() = readLine()!!.split(" ").map { it.toDouble() }
private inline fun readArrDouble(n: Int) = List<Double>(n) { reader.nextDouble() }
private inline fun readLineAsCharList() = reader.nextLine().asSequence().toList()
private inline fun readAndSolve(f: () -> Unit): Unit {
    val n = readInt()
    // usually n is the only value in string
    reader.nextLine()
    repeat(n) { f() }
}

private fun Boolean.yn() = if (this) "YES" else "NO"
private fun <T> Iterable<T>.out() = this.joinToString(" ")
private val reader = Scanner(System.`in`.bufferedReader()).apply { useLocale(Locale.US) }

@ExperimentalStdlibApi
fun main() = solve1391C()

@ExperimentalStdlibApi
private fun solve1391C() {

    val n = readInt()

    val mod = 1000_000_007L

    // ans = n! - 2^(n-1)

    var fact = 1L
    for (i in 2..n)
        fact = (fact * i) % mod

    var powtwo = 2L
    for (i in 3..n)
        powtwo = (powtwo * 2) % mod

    val ans = (fact + (mod - powtwo) % mod ) % mod

    println(ans)

}

import java.io.*
import java.util.*
import kotlin.math.*

fun main(){
	val f = BufferedReader(InputStreamReader(System.`in`))

	val n = f.readLine().toInt()

	val MOD : Long = 1000000007L

	val fac = LongArray(1000005){0L}
	val pow2 = LongArray(1000005){0L}
	fac[0] = 1L
	pow2[0] = 1L

	for(k in 1 until 1000005){
		fac[k] = (k.toLong()*fac[k-1] + MOD)%MOD
		pow2[k] = (2L*pow2[k-1] + MOD)%MOD
	}

	val answer = ((fac[n]-pow2[n-1] + MOD)%MOD+MOD)%MOD
	println(answer)
}

const val MOD = 1000000007L

fun main() {
    val n = readLine()!!.toInt()
    var answer = 1L
    for (j in 1L..n.toLong()) {
        answer *= j
        answer %= MOD
    }
    var subtractend = 1L
    for (j in 2..n) {
        subtractend *= 2L
        subtractend %= MOD
    }
    answer -= subtractend
    answer %= MOD
    answer += MOD
    answer %= MOD
    println(answer)
}

import java.io.*
import java.util.*
import kotlin.math.*

fun min(a: Int, b: Int): Int {
    if (a < b) {
        return a
    } else {
        return b
    }
}

fun max(a: Int, b: Int): Int {
    if (a > b) {
        return a
    } else {
        return b
    }
}

fun main(args:Array<String>) {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    val writer = BufferedWriter(OutputStreamWriter(System.out))

    val n = reader.readLine().toLong()
    val mn: Long = 1000000000 + 7

    var ans: Long = 1
    var minus: Long = 1
    for (i in 1..n-1) {
	ans *= i
	ans %= mn

	if (i.toInt() != 1) {
	    minus *= 2
	    minus %= mn
	}
    }

    ans = (n*ans - minus*2) % mn

    writer.write("$ans\n")

    writer.flush()
    reader.close()
    writer.close()
}

fun readInt() = readLine()!!.toInt()

const val MOD: Int = 1_000_000_000 + 7

inline class IntMod(private val i: Int) {
    operator fun plus(increment: IntMod): IntMod = IntMod(Math.floorMod(i + increment.i, MOD))

    operator fun minus(other: IntMod): IntMod = IntMod(Math.floorMod(i - other.i, MOD))

    operator fun times(other: IntMod): IntMod = IntMod(Math.floorMod(i.toLong() * other.i, MOD.toLong()).toInt())
    operator fun times(other: Int): IntMod = this * other.moduloArithmetic()

    override fun toString(): String = i.toString()
}

fun Int.moduloArithmetic() : IntMod = IntMod(this % MOD)

fun main() {
    val n = readInt()

    // Compute:  n! - sum_i{1,n} choose(i-1, n-1)
    //        =  n! - 2^{n-1}

    var fact = 1.moduloArithmetic()
    var pow = 2.moduloArithmetic()
    for (i in 1 until n) {
        fact *= i+1
        pow *= 2
    }

    println(fact - pow)
}

import java.io.*
import java.util.*
import kotlin.math.*

fun min(a: Int, b: Int): Int {
    if (a < b) {
        return a
    } else {
        return b
    }
}

fun max(a: Int, b: Int): Int {
    if (a > b) {
        return a
    } else {
        return b
    }
}

fun main(args:Array<String>) {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    val writer = BufferedWriter(OutputStreamWriter(System.out))

    val n = reader.readLine().toLong()
    val mn: Long = 1000000000 + 7

    var ans: Long = 1
    var minus: Long = 1
    for (i in 1..n) {
	ans *= i
	ans %= mn
	if (i.toInt() != 1) {
	    minus *= 2
	    minus %= mn
	}
    }

    ans -= minus

    writer.write("$ans\n")

    writer.flush()
    reader.close()
    writer.close()
}