it is easy to find files according to times you prefer.but for getting the result of that you could use awk like this:
  awk -F\| '!/^\s*$/{if($4=="S:0"){Arr0[$1","$2","$3]+=1} else {Arr1[$1","$2","$3]+=1}}END{for(i in Arr1){print i,",",Arr0[i],",",Arr1[i]}}'
for explanation:
- -F|: define - |as field seperator
- !/^\s*$/: skip empty lines 
- if(Clause){Statement}else{statement}: clear
- END{...}: this block executes when operator riched to EOF
 The awk program, pretty-printed:
! /^\s*$/ {
        if ($4 == "S:0")
                Arr0[$1 "," $2 "," $3] += 1
        else
                Arr1[$1 "," $2 "," $3] += 1
}
END {
        for (i in Arr1)
                print i, ",", Arr0[i], ",", Arr1[i]
}
 
                 
                 
                