# [Java (JDK 10)], 110 bytes <!-- language-all: lang-java --> <pre><code>s->"8%06(*D0t0".charAt(s.split("g")[0].chars().sum()%77%24%13)*(s.charAt(0)%2+2)*(s.endsWith("g")?3:4)/160d </code></pre> [Try it online!][TIO-jiak35p9] [Java (JDK 10)]: http://jdk.java.net/ [TIO-jiak35p9]: https://tio.run/##ZZM7b9swEIB3D527FDiwEED5QT3sxEZSpwhgZOvUAh2CDKwsMnT1AkmlDVL/dpd62CIVLdTH7@54etyBvtDFYf/7JPKqlBoOhkmtRUZYXSRalAWZ3k5sqdO/utlLMqoUfKOigLcJQFX/ykQCSlNtlpdS7CE3Dn/XUhT88Qmo5MpvQwF@lLvSxKcP/Rlfuqg7YLA9qcUd2ngfw2s83X0IdfgJkeSZynuNFVFVJjRGHPmP4VO7rbBPVJ1j31uvvXjlRUt/agL7jND34lnc7qTFXv0U@rnN/rq8WflBdB3uT7dtR5c2daq0gq1ptN0HQP/QHKwrCOCKbOYX62pjY7IeLDja2IhsrgY9e69XtnZ8q2Pb2tpY@2A5bmtJVlbTcnRuTKLBsvePZD8wG@cOr4ojK84GcGjm0hhdlk5Rh5ijWjpjMJjAvgcbZg6MyEFpl7OB2cIGbgvudMCdFrjbAx81YbN0ijrEHHWhY/d779JE5DR7KGVONbBu2UKR/nEVRiH53FzI7xJNaD/C7WTcdPNxnuPz3IBMVZ01FbvSpFswI7Sqstd71Y07bpL9vrLJfVU6zUlZa1KZKpph5C2iUHnKK8wv1gTP@8p9zrH5vMfJ8fQf "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).