#include <concepts>
#include <iostream>
#include <limits>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
template <class T>
concept Reading = std::integral<T> && (!std::same_as<T, bool>);
template <Reading T> long long total(const std::vector<T> &values) {
  long long result = 0;
  for (T value : values) {
    if (!std::in_range<long long>(value))
      throw std::overflow_error("Input too large");
    const auto next = static_cast<long long>(value);
    if ((next > 0 && result > std::numeric_limits<long long>::max() - next) ||
        (next < 0 && result < std::numeric_limits<long long>::min() - next))
      throw std::overflow_error("Total too large");
    result += next;
  }
  return result;
}
static_assert(Reading<int>);
static_assert(!Reading<std::string>);
static_assert(!Reading<bool>);
int main() {
  if (total(std::vector<int>{1, 2, 3}) != 6)
    throw std::runtime_error("Wrong total");
  if (total(std::vector<short>{}) != 0)
    throw std::runtime_error("Empty total");
  std::cout << "constraints verified\n";
}
