
import sun.nio.cs.ext.MacArabic
import java.util.*

fun Int.abs(): Int = if (this < 0) -this else this

class State(private val mArray: Array<String>){
    operator fun get(x: Int, y: Int): Boolean = mArray[y][x] == '#'
    operator fun get(coordinate: Coordinate): Boolean = mArray[coordinate.y][coordinate.x] == '#'
}
class CountTree{
    val mArray: Array<Int>
    constructor(array: Iterable<Boolean>){
        mArray = array.map{if (it) 1 else 0}.toTypedArray()
        for (i in 1 until mArray.size){
            mArray[i] += mArray[i - 1]
        }
    }
    operator fun get(from: Int, toInclusive: Int): Int = if (from <= toInclusive) (if (mArray.indices.contains(toInclusive)) mArray[toInclusive] else mArray.last()) - (if (mArray.indices.contains(from - 1)) mArray[from - 1] else 0) else 0
}
data class Coordinate(val x: Int, val y: Int) {
    operator fun plus(that: Coordinate): Coordinate = Coordinate(x + that.x, y + that.y)
    fun manhattanDistance(that: Coordinate): Int = abs(x - that.x) + abs(y - that.y)
}

fun main(args:Array<String>): Unit {
    val (h, w) = readLine()!!.trim().split(' ').map(String::toInt)
    val state = State(Array(h){readLine()!!.trim()})
    val migiagari = ((-w + 1) until h).map{d ->
        (0 until w).filter{x -> (0 until h).contains(x + d)}.map{x -> Coordinate(x, x + d)}.toTypedArray()
    }.toTypedArray()
    val migisagari = (0 until (h + w - 1)).map{d ->
        (0 until w).filter{x -> (0 until h).contains(d - x)}.map{x -> Coordinate(x, d - x)}.toTypedArray()
    }.toTypedArray()
    val agariSum = ((-w + 1) until h).map{d -> CountTree((0 until w).map{x -> (0 until h).contains(x + d) && state[x, x + d]})}.toTypedArray()
    val sagariSum = (0 until (h + w - 1)).map{d -> CountTree((0 until w).map{x -> (0 until h).contains(d - x) && state[x, d - x]})}.toTypedArray()
    var count = 0L
    for (migiIndex in migiagari.indices){
        val migi = migiagari[migiIndex]
        if (migi.isNotEmpty()) {
            val coins = migi.filter { state[it] }.toTypedArray()
            for (a in coins.indices) {
                val coinA = coins[a]
                for (b in (a + 1) until coins.size) {
                    val coinB = coins[b]
                    val dist = coinA.manhattanDistance(coinB)
                    if (agariSum.indices.contains(dist + migiIndex)){
                        count += agariSum[dist + migiIndex][coinA.x - dist / 2, coinA.x]
                    }
                    if (agariSum.indices.contains(migiIndex - dist)) {
                        count += agariSum[migiIndex - dist][coinB.x, coinB.x + dist / 2]
                    }
                }
            }
        }
    }
    for (hidariIndex in migisagari.indices){
        val hidari = migisagari[hidariIndex]
        if (hidari.isNotEmpty()){
            val coins = hidari.filter{state[it]}.toTypedArray()
            for (a in coins.indices){
                val coinA = coins[a]
                for (b in (a + 1) until coins.size){
                    val coinB = coins[b]
                    val dist = coinA.manhattanDistance(coinB)
                    if (sagariSum.indices.contains(dist + hidariIndex)){
                        count += sagariSum[dist + hidariIndex][coinB.x + 1, coinB.x + dist / 2 - 1]
                    }
                    if (sagariSum.indices.contains(hidariIndex - dist)){
                        count += sagariSum[hidariIndex - dist][coinA.x - dist / 2 + 1, coinA.x - 1]
                    }
                }
            }
        }
    }
    println(
            count
    )
}