petya love lucky number everybody know lucky number positive integer decimal record contain lucky digit 4 7 for example number 47 744 4 lucky 5 17 467 notPetya array n integer the number array number start 1 unfortunately petya misbehave parent do not allow play array lucky number it guarantee 1000 element array lucky number Petya need find number pair nonintersecte segment l1r1 l2r2 1l1r1l2r2n number integer there s lucky number occur simultaneously subarray al1r1 subarray al2r2 help petya count number pair