Given a cube, on each edge, write a number, either $1$ or $-1$. For each face of the cube, multiply the four numbers on the edges of this face and write the product on this face. Finally, add all the eighteen numbers that were written on the edges and faces of the cube.

What is the smallest possible sum that can be obtained?

Let's think step by step and output the final answer within \boxed{}.
user