case 1

if any number is equal to 0 or 5, then 1

if any number is equal to 1 or 6, then 2

if any number is equal to 2 or 7, then 3

if any number is equal to 3 or 8, then 4

if any number is equal to 4 or 9, then 5

example:

f2:h2=3,5,9

result

415

f2:h2=0,2,7

result

133