import java.util.*

var _map = mutableMapOf<Int, MutableMap<Int, Int>>()

fun main(args : Array<String>) {
    val sc = Scanner(System.`in`)
    var total = 0
    val K = sc.nextInt()
    for(i in 1..K) {
        val _i = gck(i)
        for(j in 1..K) {
            val _j = gck(j)
            val ij = _i.filterKeys { key -> _j.containsKey(key) }
            for (k in 1..K) {
                val _k = gck(k)
                val ijk = ij.filterKeys { key -> _k.containsKey(key) }
                total += ijk.keys.max()!!
            }
        }
    }
    println(total)
}

fun gck(K:Int): MutableMap<Int, Int> {
    if (_map.containsKey(K)) {
        return _map.get(K)!!
    }
    var map = mutableMapOf<Int, Int>()
    for(i in 1..K) {
        if (K % i == 0) {
            map.put(i, K/i)
        }
    }
    _map.put(K, map)
    return map
}
