'''
Online Python Compiler.
Code, Compile, Run and Debug python program online.
Write your code in this editor and press "Run" button to execute it.
'''
def FMHash(obj, case):
alen = len(obj)
hash1 = 42
hash2 = hash1
if case : obj = obj.lower()
for i in range(0, alen):
c = obj[i]
if obj[i].isspace() : ++hash2
else : hash1 += ord(c[0]) * (1 + i - hash2)
return hash1 + hash2 - alen
print(FMHash("hello World!", 1))
print(FMHash("hello world!", 1))