+---+
| D |
+---+---+---+---+
| E | A | B | F |
+---+---+---+---+
| C |
+---+
Each of the six faces of a die has one number written on it. Folding the net above makes a die whose numbers face outward.
You are given the numbers written at positions A, B, C, D, E, and F in the net.
Jimin has N^3 identical dice. He wants to rotate and stack them to make an N × N × N cube. The cube is placed on a table, so among its six outer faces, only the 5 faces other than the bottom are visible.
Given N and the six numbers on the die, find the minimum possible sum of all numbers written on visible faces.