# [Java (JDK 10)], 113 bytes <!-- language-all: lang-java --> <pre><code>s->"8%06(*D0t0".charAt(s.replace("g","").chars().sum()%77%24%13)*(s.charAt(0)%2+2)/40d*(s.endsWith("g")?.75:1) </code></pre> [Try it online!][TIO-jiajh8j0] [Java (JDK 10)]: http://jdk.java.net/ [TIO-jiajh8j0]: https://tio.run/##ZZNJb9swEIXvPuTcS4EBCwGkF2qJHRtJnSKAkVtPLdBD0QMjk4ocbSCptEHr3@5Siy1S0YV6/GYen5Y5sFe2OOxfTmlelVLDwWha6zSjoi5inZYFnd5NbKj5H93sxRlTCr6ytIC/E4CqfsrSGJRm2iyvZbqH3DD8Tcu0SH7@AiYTRdpSgO/lrjT1/LE/43NXdQ8Ctie1uEcb70Nwg6e7q0AHHxGNn5l80FhRyauMxRyjBM0RIi1QmFBV55h467UXLb3wmkxNad8TEC@aRcRfBvtmlxd79SPVz40D@ULXq9uQnO7aUJekmiutYGuytvsA6B@ag3X5PqzoZn6hLjY0ouuBgoMNDelmNeDZe7y0scNbHNnUxobaB8txrGu6tELL0bkRDQcq3j@S/cBi3Du8KvNlhjpbgKNmrhpLV0vH1FHCQa06S38gvn0Ptpg5YqQcKW07Wwgb2CKxQeIkSJwIiZshGYWwtXRMHSUcdFHH7vfe8TjNWfZYypxpEN2yhYL/dhFGAf3UXIh0jaa0n@J2Mm67@TiP8nluQHJVZ41jZ027BQvKqip7e1DdxOOmmfTOpvdNaZ7Tsta0Mi5aYOQtwkB5yivML9YUz3vnvufYfN7j5Hj6Dw "Java (JDK 10) – Try It Online" ## Credits * Port of [TFeld's Python 2 answer](https://codegolf.stackexchange.com/a/166644/16236). * -1 byte thanks to [Kevin Cruijssen](https://codegolf.stackexchange.com/users/52210/kevin-cruijssen).