#include <iostream>
#include <utility>
#include <vector>

template <int a, int b, int c> void foo() { std::cout << a << b << c << std::endl; }

template <std::size_t ... Is>
void foo(int index, std::index_sequence<Is...>)
{
    using f_type = void();
    f_type* f[] = {&foo<1 + Is / 16, 1 + (Is / 4) % 4, 1 + Is % 4>...};
    
    f[index]();
}

void foo(int a, int b, int c)
{
    foo((a - 1) * 16 + (b - 1) * 4 + c - 1, std::make_index_sequence<64>());   
}


int main()
{
    foo(1, 1, 1);
    foo(1, 2, 3);
    foo(4, 4, 4);
}