import scala.io.StdIn._
import scala.annotation.tailrec

object Main extends App {

  @tailrec
  def gcd(a: Int, b: Int): Int = {
    if(b == 0) a else gcd(b, a % b)
  }

  val all = 1 to readInt()

  println(Seq(all.sum,
    all.combinations(2).map(combi => gcd(combi(0), combi(1))).sum*6,
    all.combinations(3).map(combi => gcd(gcd(combi(0), combi(1)), combi(2))).sum*6).foldLeft(0)(_+_))
}
