#include <stdio.h> int hash(const char *str) { int sum = 0; for (int i=0;;i++) { if (str[i] == '\0') break; sum += ((int)str[i] * 10 + i); } return sum%2069; } int main(int argc, char **argv) { if (argc < 2) { printf("usage: a.out string\n"); } else { printf("%d\n", hash(argv[1])); } return 0; }