Ruler on fingers problem

Question

Hints

Answer