calculates chiefs for all possibilities
giving up, going to different problem
started NSYSTEM SPOJ problem
started implementing string to int translation
adding prefix logic
got string to integer working