Pass 2 custom variables to categories

Hello

I need to pass 2 variables for categories so I can have something like this:

http://example.com/category-slug/VALUE1/VALUE2
http://example.com/category-slug/subcategory-slug/VALUE1/VALUE2

I read something about add_rewrite_rule but not fully understanding how to make it work for just categories and subcategories

Thanks

Adrian