That actually has problems with large numbers (> native integer ?) Once it gets over 64 bits on my machine it converts to scientific notation... which throws off the conversion.
Never mind. Broken
Here's my whack at it  232 strokes
perl E'@x=split//,"4335443554366887798866555766";$_=<>;chop;print;whi
+le($_4){split//,"99aabb87780";$x=0;$x+=hex(pop)*!!$&+($1&&$x[$1]+7)+
+($2>1?$x[$2+18]+$x[$3]:$x[$2.$3])while s/(.??)(.?)(.)$//;say" is $x."
+;print$_=$x}say" is magic."'
__END__
999999999999999999999999999999999
999999999999999999999999999999999 is 231.
231 is 19.
19 is 8.
8 is 5.
5 is 4.
4 is magic.
