#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define all(v) v.begin(), v.end()
#define lint long long
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#define debug(...)\
  std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha

template <typename T>
auto make_vector_impl(size_t sz, T t) {return std::vector<T>(sz, t);}

template <size_t N, typename T, typename U, std::enable_if_t<N == 1, std::nullptr_t> = nullptr>
auto make_vector(size_t sz, U u) {return make_vector_impl(sz, T(u));}

template <size_t N, typename T, std::enable_if_t<N == 1, std::nullptr_t> = nullptr>
auto make_vector(size_t sz) {return std::vector<T>(sz);}

template <size_t N, typename T, typename... Args, std::enable_if_t<N != 1, std::nullptr_t> = nullptr>
auto make_vector(size_t a, Args... args) {return make_vector_impl(a, make_vector<N - 1, T>(args...));}

template <typename T, typename Size_t>
auto& at(T& t, Size_t i) {return t.at(i);}

template <typename T, typename Size_t, typename... Args>
auto& at(T& t, Size_t i, Args... args) {return at(t.at(i), args...);}

template <typename T>
std::istream& operator>> (std::istream& is, std::vector<T>& v) {
  for (auto & x : v) is >> x;
  return is;
}

template <typename T>
std::ostream& operator<< (std::ostream& os, const std::vector<T>& v) {
  auto n = v.size();
  os << "{";
  for (size_t i = 0; i < n; i++)
    {os << (i > 0 ? "," : "") << v.at(i);}
  return os << "}";
}

template < typename Value >
auto rotate45(std::vector< std::vector< Value > > const& grid, Value def) {
  int h = grid.size();
  int w = grid.front().size();
  auto even = std::vector< std::vector < Value > >((h + w) / 2, std::vector< Value >((h + w) / 2, def));
  auto odd  = std::vector< std::vector < Value > >((h + w) / 2, std::vector< Value >((h + w) / 2, def));
  for (auto i = 0; i < h; i++) {
    for(auto j = 0; j < w; j++) {
      ((i + j) % 2 == 0 ? even : odd)
        .at((i + j) / 2)
        .at((h - 1 - i + j) / 2)
        = grid.at(i).at(j);
    }
  }
  return std::make_pair(even, odd);
}

template < typename Value >
auto reflect(std::vector< std::vector< Value > > const& grid) {
  int h = grid.size();
  int w = grid.front().size();
  auto ret = std::vector< std::vector< Value > > (w, std::vector< Value >(h));
  for (auto i = 0; i < h; i++) {
    for(auto j = 0; j < w; j++) {
      ret.at(j).at(i) = grid.at(i).at(j);
    }
  }
  return ret;
}

template < typename Grid >
auto print_grid(Grid const& grid) {
  int h = grid.size();
  int w = grid.front().size();
  for (auto i = 0; i < h; i++) {
    for(auto j = 0; j < w; j++) {
      std::cout << (grid.at(i).at(j) ? '#' : '.');
    }
    std::cout << std::endl;
  }
}

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int h, w; std::cin >> h >> w;
  auto original = make_vector< 2, int >(h, w, 0);
  rep(i, 0, h) rep(j, 0, w) {
    char c; std::cin >> c;
    at(original, i, j) = (c == '#');
  }
  std::vector< std::vector< int > > even, odd;
  std::tie(even, odd) = rotate45(original, 0);
  auto ret = 0LL;
  for (auto grid : {even, odd}) {
    loop(2) {
      int h = grid.size();
      int w = grid.front().size();
      rep(i, 0, h) {
        auto cum = std::vector< int >(w, 0);
        std::partial_sum(all(grid.at(i)), cum.begin());
        cum.insert(cum.begin(), 0);
        rep(k, 0, h) {
          if (k == i)
            { continue; }
          auto d = std::abs(i - k);
          rep(l, 0, w - d) {
            auto r = l + d;
            if (!at(grid, k, l) || !at(grid, k, r))
              { continue; }
            ret +=
                at(grid, i, l)
              + at(grid, i, r)
              + 2 * (cum.at(r) - cum.at(l + 1));
          }
        }
      }
      grid = reflect(grid);
    }
  }
  ret /= 2;
  std::cout << ret << std::endl;
  return 0;
}


Measured memory_bytes: 2860