#include <stdio.h>
#include <string.h>
#define NHASH 29989
#define MULT 31

unsigned int simple_hash(char *p)
{
  unsigned int h = 0;
  for(; *p; p++)
    h = MULT * h + tolower(*p);
  return h % NHASH;
}

int main()
{
  char in[256];
  while (1)
  {
    fgets(in,256,stdin);
    in[strlen(in)-1]=0;
    printf("=> %i\n",simple_hash(in));
  }
}
