OnlineJudge 3 现已推出。点此体验新版：Best string Orz~ | SDUT OnlineJudge
Best string Orz~
Time Limit: 3000 ms Memory Limit: 65536 KiB
If a string S is made up by n1 'O',n2 'r', n3 'z' and n4 '~',(n1>=n2>=n3>=n4),and for all of its prefix substring C,if in C the number of 'O' is larger or equal than the number of 'r',the number of 'r' is larger or equal than the number of 'z' and the number of 'z' is larger or equal than the number of '~',then we call it best string.(For example,the prefix substring of "Orz~" is "O","Or","Orz" and "Orz~").
Now give you the n1,n2,n3,n4,I wonder how many best strings are there with only n1 'O',n2 'r',n3 'z',n4 '~';
There are more than one input.
Each input is four number n1,n2,n3,n4,end by four zeros,which shouldn\'t be processed.(0<=n1,n2,n3,n4<10)
For each input,print the number of best string.
1 1 1 1 0 0 0 0