Hi!
I've recently wrote a simple module nginx-let-module for myself providing arithmetic (and string op) support in NGINX.
it supports parentheses, hex, simple ops. here's an example:
let $value ( $uid + 0x12 ) * $offset - 100 ;
it's here
https://github.com/arut/nginx-let-module