# Java 8, <s>141</s> <s>136</s> 134 bytes <!-- language-all: lang-java --> s->{float q=s.split("!",-1).length,n=new Float(s.split("!")[0]),i=n,r=n;for(;--i>0;r=q<3?i*r:q<4?i+r:q<5?i-r:i/r);return n<1&q<3?1:r;} -5 bytes (141 → 136) thanks to [*@CarlosAlejo*'s C# answer](https://codegolf.stackexchange.com/a/137334/52210). **Explanation:** [Try it here.](https://tio.run/##dVBNU8IwEL3zK9YenMZ@SEe9NA3cvMGFI@MhloALZVuSgDpMf3tNbQ4oOpOP2d03b997W3mSSd0o2q52XVlJY2Amkc4jACSr9FqWCuZ9CbCuammhDBdWI23AMO7arbvuGCstljAHAgGdSSbnAX0QJjVNhTYMboI4yVhaKdrYt5gEqXd47kHhBYQtxy8sRkGxFsTXtQ55kuBkzLU4FA9TvNP5oXicYtT/T1NMdI73mnGt7FETUJHd9rgs17zt@KCtOb5WTpuXeKpxBXvn0ftYvoBkg0GrzCCCX5ZX9XXDd3wWjcaTtOrHwm@oD059uKD3blbTTOqd8dt7sy5zQDHmWIjMvVHkZwCLT2PVPq2PNnX8ZCsKMfrNFAU5BBGl5R8z5kW3o3/ovIW2@wI) s->{ // Method with String parameter and float return-type float q=s.split("!",-1).length, // Amount of exclamation marks + 1 n=new Float(s.split("!")[0]), // The number before the exclamation marks i=n, // Index (starting at `n`) r=n; // Return sum (starting at `n`) for(;--i>0; // Loop from `i-1` down to 1 r= // Change the result (`r`) to: q<3? // If `q` is 2: i*r // Multiply :q<4? // Else if `q` is 3: i+r // Addition :q<5? // Else if `q` is 4: i-r // Subtraction : // Else (if `q` is 5): i/r // Division ); // End of loop return n<1&q<3? // Edge case if the input is `0!`: 1 // Then return 1 : // Else: r; // Return the result } // End of method