If that is all the information you need you can let PowerShell add up the data for you.
I also added a little bit more error checking.
foreach ($cluster in Get-Cluster)
{
$vmhosts = @($cluster | Get-VMHost)
# Skip to the next cluster if there were no hosts in this one.
if ($vmhosts.Length -eq 0)
{
continue
}
$firsthost = $vmhosts[0]
$totalCapacity = ($firsthost | Get-Datastore | Measure-Object -Property CapacityMb -Sum).Sum
$cluster | Select-Object Name, @{Name="TotalCapacityMb"; Expression={$totalCapacity}}
}